undefined index error code is not working...session variable not stored

[php]<?php session_start(); ?>

Php superglobal arrays First name

Last name

<?php if(isset($_POST['submit'])) { $first=$_SESSION['first']=$_POST['first']; $last=$_SESSION['last']=$_POST['last']; } ?> [/php]

Well…if that bottom code is on the same page as the form, then you need to take out the action. You also need to give your submit button a name, else it doesn’t know what $_POST[‘submit’] is.

Sponsor our Newsletter | Privacy Policy | Terms of Service