Page 1 of 1

php form handling problems

Posted: Fri Nov 08, 2002 10:48 am
by ethan
Hi, I'm running PHP 4.2.3 on Apache 2.0.43. All this runs on my Linux system. Everything goes well in the first try to ensure that all works ... phpinfo() displays the relevant webpage ... but the problem is when i try to submit a form to a php page, the php code cannot access the form controls. For example this is my code:

<input type = "text" name = "username" />

and when i submit the page back to itself (ie form.php)
print ("Hi");
print ("$username");

doesnt work ... only prints hi ... why ???? pls help thank you

Posted: Fri Nov 08, 2002 11:44 am
by f1nutter
This may seem trivial, but you are getting $username from the $_GET array aren't you?

Code: Select all

&lt;?php

$username = $_GET&#1111;"username"];

?&gt;

Posted: Fri Nov 08, 2002 12:49 pm
by jabustos
Need to use $_POST

<?php

$username = $_POST["username"];

?>

Posted: Fri Nov 08, 2002 3:03 pm
by ethan
oooooooooooo ... now i know ... hmm ... looks like its getting a php reference book fer me ... kekek
thanks everyone! =c)

Posted: Fri Nov 08, 2002 5:07 pm
by mydimension
have a good read of this: viewtopic.php?t=511