• 14
• 12
• 9
• 10
• 9

Need help with embarrasingly simple php program

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

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>
<title>Age</title>
<body>
<form action="action.php" method="post">
<table>
<tr>
<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 on other sites

error_reporting(E_ALL);

or such at the start of your code.