Page 1 of 1

How worth is the software XAMPP

PostPosted: 30. December 2010 13:31
by AAA123
How worth is the software XAMPP if it can not display entered value in following script "get-it.php"
(Apache works, php.ini as original)
<?
echo '<HTML><HEAD><TITLE> Get and Display</TITLE><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-2">';
echo '</HEAD><BODY>';

if ($tekst) { print "Entered value <B>$tekst</B><BR>";
print '<A HREF="http://localhost/get-it.php"> Back </A>';

} else { // no data, display the form
print '<FORM ACTION="http://localhost/get-it.php" METHOD=GET>';
print '<INPUT TYPE="text" NAME="tekst">';
print '<INPUT TYPE="submit" VALUE="Send">';
print '</FORM>';
}
echo '</BODY></HTML>';
?>

Re: How worth is the software XAMPP

PostPosted: 30. December 2010 13:34
by Sharley
Try using <?php instead of <? as in XAMPP 1.7.3 short_open_tags are set to off by default.

Please read the comments in the php.ini file about short_open_tags.

Re: How worth is the software XAMPP

PostPosted: 30. December 2010 13:52
by AAA123
I've changed <? into <?php , but it still doesnt work!

Re: How worth is the software XAMPP

PostPosted: 30. December 2010 13:59
by Sharley
What does not working for you mean?

Details please so it can be checked out - what do you see in your browser, error messages etc?

What are you typing in your browser's address bar?

Re: How worth is the software XAMPP

PostPosted: 30. December 2010 14:47
by AAA123
1) First you see
http://localhost/get-it.php
^^^^^^^^^^^^^^^^^^^^^^^^^
field [abba ] button [Send]
----------------------------------------------------------------------

2) After clicking on "Send" button in Mozilla Firefox you may see
http://localhost/get-it.php?tekst=abba
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
field[ now is empty ] button [Send]

PS. I have screen dumps showing explanation above ,
but I dont see any possibilities how to attach it to the forum

Re: How worth is the software XAMPP

PostPosted: 30. December 2010 16:27
by AAA123
* Edit post
* Delete post
* Report this post
* Reply with quote

Re: How worth is the software XAMPP
Postby AAA123 ยป 30. December 2010 14:47

The script "get-it.php" (see prev topic events) is elementary and worked under Apache1.3 and PHP4.3, but under XAMPP it does not display entered value!

1) First you type in address bar:
http://localhost/get-it.php
^^^^^^^^^^^^^^^^^^^^^^^^^
The following form is displayed:

field [abba ] button [Send]
----------------------------------------------------------------------

2) After clicking on "Send" button you may see in address bar:
http://localhost/get-it.php?tekst=abba
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The following form is displayed:

field[ now is empty ] button [Send]

Good, but also sould be displayed a message "The entered value abba".
But is not. Help!

PS. I have screen dumps showing explanation above ,
but I dont see any possibilities how to attach it to the forum

Re: How worth is the software XAMPP

PostPosted: 30. December 2010 16:30
by Altrea
try $_GET['tekst'] instead of $tekst.

global values will not be transfered to local variables since register_globals is set to off (and thats a good change for security)

Re: How worth is the software XAMPP

PostPosted: 30. December 2010 19:11
by AAA123
Altrea wrote:
try $_GET['tekst'] instead of $tekst

I did, then the script "get-it.php" results in following message:

Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in C:\xampp\htdocs\get-it.php on line 4 (the line now containing supposed $_GET['tekst']

Re: How worth is the software XAMPP

PostPosted: 30. December 2010 21:46
by Altrea
Please show your sourcecode again with the changes you made (and please use the "code BB-Tags" for better reading).
Somewhere in your code you have done something wrong

Re: How worth is the software XAMPP

PostPosted: 31. December 2010 09:25
by AAA123
Here is code with changet $tekst into $_GET['tekst'].
Because Internet browser does not interpret involved tags in this message, you see all good as is.
(bb-tags will rather confuse).
The script only test if method GET works. After the submision of entered value, it is added into current URL after ? (for example): http://localhost/get-it.php?$tekst=value.
Then it should be displayed. The variable name used by GET is the same as the field name in the form.

<?php
echo '<HTML><HEAD><TITLE> Get and Display</TITLE><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-2">';
echo '</HEAD><BODY>';

if ($_GET['tekst']) { print "Entered value: <B>$_GET['tekst']</B><BR>";
print '<A HREF="http://localhost/get-it.php"> Back </A>';

} else { // no data, display the form
print '<FORM ACTION="http://localhost/get-it.php" METHOD=GET>';
print '<INPUT TYPE="text" NAME="tekst">';
print '<INPUT TYPE="submit" VALUE="Send">';
print '</FORM>';
}
echo '</BODY></HTML>';
?>

Re: How worth is the software XAMPP

PostPosted: 31. December 2010 15:02
by Altrea
AAA123 wrote:print "Entered value: <B>$_GET['tekst']</B><BR>";

This can't work this way.

Two possibilities for Array-Values in print:

Code: Select all
print "Entered value: <B>{$_GET['tekst']}</B><BR>";

Code: Select all
print "Entered value: <B>" .$_GET['tekst']. "</B><BR>";

Re: How worth is the software XAMPP

PostPosted: 01. January 2011 13:55
by AAA123
Altrea thanks you very much for the hint to display entered value from the form field ie:

print "Entered value: <B>{$_GET['tekst']}</B><BR>";

but value is not displayed still.

I decided to set in "php.ini"

register_globals = On

and now it works.

Re: How worth is the software XAMPP

PostPosted: 01. January 2011 15:48
by Altrea
register_globals can be a big security issue, especially if you have just basic php knowledge.
And register_globals will be returned with the release of PHP 6.

So my suggestion is that you should learn to write clean and secure PHP scripts right know and leave register_globals off.