Dear friends,
I want to transfer data from one page to other via SESSION variables my code of session1.php page is below
<!DOCTYPE html>
<html>
<head>
<title>Hello!</title>
</head>
<body>
<form action="session2.php" method="post">
<input type="text" name="text" />
<input type="submit" name="submit" />
</form>
<?php
session_start();
$text=$_POST['text'];
$_SESSION['stext']=$text;
echo("session is set");
?>
</body>
</html>
and second code of session2.php
<!DOCTYPE html>
<html>
<head>
<title>Hello!</title>
</head>
<body>
<?php
session_start();
if(isset($_POST['submit'])){
echo ":". $_SESSION['stext'];
}
?>
</body>
</html>
i got error
Notice: Undefined index: text in C:\wamp\www\Exercises\session1.php on line 16
please, guide me.