Problem with POST

Everything that doesn't belong to any other forum but this one. If it doesn't belong here then it ... well, it just doesn't.

Moderator: mkoch227

Post Reply
ChickNew
Posts: 8
Joined: Tue Jan 31, 2006 10:14 pm

Problem with POST

Post 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. :?:
Chick
damienwc
Posts: 7
Joined: Mon Jun 05, 2006 2:53 am

Post 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.
ChickNew
Posts: 8
Joined: Tue Jan 31, 2006 10:14 pm

Post 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.
Chick
FruitBeard
Posts: 38
Joined: Thu Jul 21, 2005 6:25 pm

Post by FruitBeard »

Hi there,

try adding:


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

I think that is it !!!
FruitFully yours

http://www.fgps.com/keith/
Post Reply