dahwan Posted December 23, 2006 Share Posted December 23, 2006 i am testing out sessions but i cant make them work. I tried to create a tiiny biiny game where i am suposed to write my name, and the results tells me if i wrote my name or not :PGame.php :[code]<?phpsession_start()?><link rel="stylesheet" type="text\css" href="styles\main.css"><table class="TextTable"> <tr> <th> Try and write "Tomas" in this box =P </th> </tr> <tr> </tr> <tr> <td> <form method="post" action="gameCheck.php"> <input type="text" name="name"><input type="submit" value="check"> </form> </td> </tr></table><br><table> <tr> <td> Results:<br> <?php if(isset($_session['wrong'])) { echo "" . $_session['wrong'] . ""; unset($_session['wrong']); } ?> </td> </tr></table>[/code]gameCheck.php :[code]<?phpSESSION_START();$name = $_POST['name'];if ( $name == tomas ) { $_session['wrong'] = "well look at that, you DO know how to write ;)"; header("location: game.php"); }else{ $_session['wrong'] = "thats not my name!"; header("location: game.php"); }?>[/code]The game (not showing any results)[url=http://www.dahwan.com/game.php]http://www.dahwan.com/game.php[/url]If anyone could tell me why this does not work that would be really nice.Thanks!DahWan Quote Link to comment https://forums.phpfreaks.com/topic/31729-solved-php-sessions/ Share on other sites More sharing options...
Jessica Posted December 23, 2006 Share Posted December 23, 2006 session_start();$_SESSION[]You keep mixing up your capitalization. Plus you have an unquoted string. It should say 'tomas' or "tomas" not just tomas. Quote Link to comment https://forums.phpfreaks.com/topic/31729-solved-php-sessions/#findComment-147079 Share on other sites More sharing options...
dahwan Posted December 24, 2006 Author Share Posted December 24, 2006 Thank you!! everything you said was right, and the game is working now ^^check it out Quote Link to comment https://forums.phpfreaks.com/topic/31729-solved-php-sessions/#findComment-147128 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.