cannot set a variable to base on user input post method

Posted by user1318960 on Stack Overflow See other posts from Stack Overflow or by user1318960
Published on 2012-04-07T11:21:12Z Indexed on 2012/04/07 11:29 UTC
Read the original article Hit count: 203

Filed under:

Hello i´m trying to set info from a post method into a variable that sets a session named name the value that the user input. I get the following error:

Notice: Undefined index: name in F:\xampp\htdocs\Impossible game\index.php on line 18

This is line 18: $session = $_POST['name'];

<form action="ms1.php" method="POST">
Name <input type="text" name="name">
<input type="Submit" value="Begin">
</form>
<?php
$session = $_POST['name']; 
session_start();
$_SESSION['name'] = $session;

© Stack Overflow or respective owner

Related posts about php