Jump to content
  • Advertisement
Sign in to follow this  
Evil Booger

Need help with embarrasingly simple php program

This topic is 4098 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Ok I already made a "hello world" and decided to do a little more using Post. I want it to be a specialized hello world that gives it with a name. I am using xampp and have successfully ran my "hello world" program. I can run this program if i don't show the post variables so I think I'm not using them correctly. I'm not receiving an error so I'll just give you all the code. Heres the code for the first file (index.php):
<html>
<head>
<title>Age</title>
</head>
<body>
<form action="action.php" method="post">
<table>
<tr>
<td><p>What is your name: </p></td>
<td> <input type="text" name="name" /> </td>
</tr>
<tr><td></td>
<td><input type="submit" name="submit" value="Submit Info" /></td>
</tr>
</table>
</form>

</body>
</html>
and here's the code for the second part(action.php):
<html>
<body>
<?php
//echo "Hello, " . $_Post["name"] . ", so you say you are " . $_Post["age"] . " years old eh?";
echo $_Post["name"];
?>
</body>
</html>

Share this post


Link to post
Share on other sites
Advertisement
It's $_POST you want, not $_Post.

Also, if you edit your php.ini file and change 'error_reporting' to 'E_ALL' instead of 'E_ALL & ~E_NOTICE' it will warn you about using undefined variables.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!