Page 1 of 1

Brand new to PHP, need help

Posted: Mon Dec 12, 2011 1:19 pm
by mgp1
I have this code on one page, which works:
<html>
<head>
<title>PHP Test</title>
</head>
<body>

<?php echo '<p>Hello World</p>';
?>

<form action="action.php" method="post">
<p>Your name: <input type="text" name="name" /></p>
<p>Your age: <input type="text" name="age" /></p>
<p><input type="submit" /></p>
</form>

<?php echo $_SERVER['HTTP_USER_AGENT'];echo '<br />';
?>
<?php
if(strpos($_SERVER['HTTP_USER_AGENT'],'MSIE') !== FALSE)
{
echo 'You are using Microsoft Internet Explorer.<br />';
}
?>
<?php phpinfo();
?>

</body>
</html>

On the "Action.php" page, which works but with no variables:
Hi <?php echo htmlspecialchars($_POST['name']); ?>.
You are <?php echo (int)$_POST['age']; ?> years old.

Why are the variable values not transfered?

Re: Brand new to PHP, need help

Posted: Mon Dec 12, 2011 1:43 pm
by Celauran
One potential problem I see is that the form specifies action.php but you're talking about Action.php

Re: Brand new to PHP, need help

Posted: Mon Dec 12, 2011 2:08 pm
by mgp1
Thanks for the reply, that was a typo. Good eye. However whatever was going on seems to have worked itself out. The values are now showing up. Could something have been cached?