Forum Moderators: coopster

Message Too Old, No Replies

Cannot get variable value

         

Pointman

9:44 am on Jan 22, 2005 (gmt 0)

10+ Year Member



Ok ok I feel completely dumb.

I've spent 2 days looking at 3 lines of code being unable to find what I'm doing wrong. I'm sure for you guys and girls this will be a quiz to solve while watching your fav movie.

2 files.

index.html with the following code

<body>
<form method="POST" action="status.php">
<input id="topic" type="text">
<input id="submit" type="submit" value="Send this">;
</form>

</body>
</html>

------------------------------------------

status.php with the following code

<body>
<?php
print $_POST['topic'];
?>
</body>
</html>

------------------------------------------

I get the message
Notice: Undefined index: topic in F:#*$!/#*$!x/xxx

What am I doing wrong?

Please please please help. Spending 2 whole days for such an elementary procedure can be so frustrating

Thanks in advance for your help

P.S. Should I take any special steps cause I'm using Apache 2 on WinXP and PHP 4 on winXP as well?

mincklerstraat

10:06 am on Jan 22, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



try replacing all occurrences of id with name

<input name="topic" type="text">

and give that a spin.

Pointman

10:44 am on Jan 22, 2005 (gmt 0)

10+ Year Member



mincklerstraat thanks a bunch

That did the trick.

I wonder why it doesn't work since the id instead of name suppose to conform with the new xHTML standard bla bla bla

Oh well

Thanks alot again :)

mincklerstraat

11:02 am on Jan 22, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



np

id instead of name
is applicable for some stuff, like anchors, but not for everything - e.g. input. And if you want it xhtml valid you'll want to auto-close your input tags - /> - e.g. <input name="Joe" />

happy coding!