note 65973 rejected from ref.session by philip
| From: | philip@php.net | Date: | Thu, 11 May 2006 06:37:39 +0000 |
| Subject: | note 65973 rejected from ref.session by philip | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-111110@lists.php.net to get a copy of this message | ||
Note Submitter: ron
----
im new about php i made this code to pass variables to other website but i cant can you figure out
whats wrong with this code
<html>
<head>
<title>Sessions in PHP!</title>
</head>
<body>
<form action="show.php" method="post">
<input type="text" name="name"><br>
<input type="submit" name="submit" value="Submit my name!">
</form>
</body>
</html>
<?php
// Check to see if the form was submitted
if (isset($_POST['submit']))
{
// Because the form was submitted, do everything within this if
// Create a session variable with the users name in it
session_start();
$name = $_POST['name'];
$_SESSION['user_name'] = $name;
// echo '<a href="show.php">Next page</a>';
}
?>
<html>
<head>
<title>Outputing sessions in PHP!</title>
</head>
<body>
<?php
session_start();
$name = $_SESSION['user_name'];
echo 'Hello'.$_SESSION['user_name'];
?>
</body>
</html>