I have as my script the following..
I want to diaplay whetever I enter through the inbox...I have stored the contents in a session var......when I press th submit btn the function setanimal() always passes through the else part and display me the "guets".Doe s that mean,the session var has nt been set?How can I diaplay the input contents now?
Any help will be kindly appreciated.
thanks in advance
Code:
<?php session_start();?>
<html>
<body>I am<?php function setanimal(){echo (isset( $_SESSION['s']));
if (isset( $_SESSION['animal'])){
return $_SESSION['animal'];echo $_SESSION['animal'];}
else{
return "guets";
}
echo setanimal();}
?>
<form name="sa" action="hi.php" method="get">
<input type="text" name="name">
<input type="submit" value="submit">
</form>
<?php if (isset($_GET['name'])){echo "I am working";
$_SESSION['animal']=$_GET['name'];}?>
</body>
</html>
I want to diaplay whetever I enter through the inbox...I have stored the contents in a session var......when I press th submit btn the function setanimal() always passes through the else part and display me the "guets".Doe s that mean,the session var has nt been set?How can I diaplay the input contents now?
Any help will be kindly appreciated.
thanks in advance
Comment