These are my 2 pages
index.php:-
<?php session_start(); ?>
<html>
<head>
<title>Enter Your Name</title>
</head>
<body>
<form action="hello.php" method="post">
Wat's U'r name : <input type="text" name="name"/>
<br/>
<input type="submit" value="Next"/>
</form>
</body>
</html>
hello.php:-
<?php session_start() ?>
<html>
<head>
<title>Hey <?php echo $name; ?></title>
</head>
<body>
<?php
$_SESSION['name'] = $_POST['name'];
$name = $_SESSION['name'];
if(is
$country = $_SESSION['country'] = $_POST['Countries'];
echo "Hey " . $name . " you are from " . $country ;
else
{
if(!isset($_SESSION['name']))
{
$_SESSION['name'] = $_POST['name'];
$name = $_SESSION['name'];
}
else
{
echo " Hey ". $name . " So you are from ?<br/>";
echo "<form action=\"hello.php\" method=\"post\" /> ";
echo "<select name=\"Countries\"> ";
echo "<option value=\"India\">India</option> ";
echo "<option value=\"USA\">USA</option>";
echo "<input type=\"Submit\" value=\"Next\"/> ";
echo "</select>";
}
}
?>
<br/>
</body>
</html>
What i want to do is to store both name and country in the session array()
then print them out on hello.php as:-
Hello <name> you are from <country>...
I don't know how to do that...
This page is currently not working...
This page is not working...And