php form handling problems

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
ethan
Forum Newbie
Posts: 2
Joined: Fri Nov 08, 2002 10:48 am

php form handling problems

Post 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
f1nutter
Forum Contributor
Posts: 125
Joined: Wed Jun 05, 2002 12:08 pm
Location: London

Post 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;
jabustos
Forum Newbie
Posts: 3
Joined: Fri Nov 08, 2002 11:38 am

Post by jabustos »

Need to use $_POST

<?php

$username = $_POST["username"];

?>
ethan
Forum Newbie
Posts: 2
Joined: Fri Nov 08, 2002 10:48 am

Post by ethan »

oooooooooooo ... now i know ... hmm ... looks like its getting a php reference book fer me ... kekek
thanks everyone! =c)
User avatar
mydimension
Moderator
Posts: 531
Joined: Tue Apr 23, 2002 6:00 pm
Location: Lowell, MA USA
Contact:

Post by mydimension »

have a good read of this: viewtopic.php?t=511
Post Reply