Brand new to PHP, need help
Posted: Mon Dec 12, 2011 1:19 pm
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?
<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?