Brand new to PHP, need help

Ye' old general discussion board. Basically, for everything that isn't covered elsewhere. Come here to shoot the breeze, shoot your mouth off, or whatever suits your fancy.
This forum is not for asking programming related questions.

Moderator: General Moderators

Post Reply
mgp1
Forum Newbie
Posts: 2
Joined: Mon Dec 12, 2011 1:10 pm

Brand new to PHP, need help

Post 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?
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: Brand new to PHP, need help

Post by Celauran »

One potential problem I see is that the form specifies action.php but you're talking about Action.php
mgp1
Forum Newbie
Posts: 2
Joined: Mon Dec 12, 2011 1:10 pm

Re: Brand new to PHP, need help

Post 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?
Post Reply