Page 1 of 1

Problem with POST

Posted: Mon Feb 27, 2006 5:02 am
by ChickNew
Script URL:
Version of script:
Version of PHP:
Hosting company:
Have you searched THIS FORUM for your problem:
(if not please do before posting)
If so, what terms did you try:

Write your message below:

I am using php 5 on an Apache server on Linux remote, and Windows XP local machine. I am new to PHP...please bear with me.

I created a simple form to practice sending data from an HTML form to a php page to handle the data, sent via post. The page that is handling the posted data is not receiving it for reasons I do not understand. Here's the form:
<form action="HandleList.php" method="post">
<input type="text" name="list" size="80" /><br />
<input type="submit" value="Submit!" name="submit" />
</form>

And here's the code on the page "HandleList.php:
<?php
echo ("The data was transmitted: $List");
?>

Every time I run the form the HandList.php shows and error:

"Notice: Undefined variable: List in C:\htdocs\phpdw\HandleList.php on line 12
The variable was transmitted:"

Line 12 is contains the above text and should be showing the $List variable after the word "transmitted:"...but is not getting this value from the form via the post method.

What am I doing wrong? I really do not understand why this isn't working. It doesn't work locally or when testes on the remote server. Any help would be greatly appreciated. I am new at this...and now I am lost. :?:

Posted: Tue Jun 06, 2006 10:17 am
by damienwc
Not sure if you've found a solution to this since your post I know its been a while.

I have a question though. How can you have an error on line 12 when there are only 3 lines in the code? Anyway, from what I can see your error is in the $List variable. In your <form> tag the form name is all lower case. It should also be reflected this way in your PHP script. Try that and it should work. If it still doesnt work, try cleaning up the extra / symbols at the end of your forms tags.

Posted: Tue Jun 06, 2006 2:15 pm
by ChickNew
It took awhile to obtain a response. I figured it out myself. The variable must be sent as a $_get array or $_post array in php 5.

Thanks though. Any response, even a delayed one, is appreciated.

Posted: Thu Jun 08, 2006 6:44 am
by FruitBeard
Hi there,

try adding:


<?php
$List = $_REQUEST['List'];
echo ("The data was transmitted: $List");
?>

I think that is it !!!