pyke96 Posted February 12, 2008 Share Posted February 12, 2008 Notice: Undefined index: user in c:\webs\test\Website\add_pat.php on line 11 I keep getting this error when i try to get a label from a form and insert the information into a database. Any ideas anyone? Quote Link to comment https://forums.phpfreaks.com/topic/90716-php-error/ Share on other sites More sharing options...
trq Posted February 12, 2008 Share Posted February 12, 2008 its a Notice, not an error. its also more than likely caused by trying to index an associative array without having quotes around that index. Pretty hard to tell without seeing any code though. Quote Link to comment https://forums.phpfreaks.com/topic/90716-php-error/#findComment-464989 Share on other sites More sharing options...
pyke96 Posted February 12, 2008 Author Share Posted February 12, 2008 its a Notice, not an error. its also more than likely caused by trying to index an associative array without having quotes around that index. Pretty hard to tell without seeing any code though. <?php $pagetitle= "Wellbeing medical clinic-add new patient"; include ('./templates/header.php'); // note file path ?> <div id= "bodycontent"> <?php $_SESSION['firstname'] = $_POST['firstname']; $_SESSION['lastname'] = $_POST['lastname']; $_SESSION['username'] = $_POST['user']; $_SESSION['password'] = $_POST['pass']; $_SESSION['address'] = $_POST['address']; $_SESSION['county'] = $_POST['county']; $_SESSION['country'] = $_POST['country']; This is the code that is problematic Quote Link to comment https://forums.phpfreaks.com/topic/90716-php-error/#findComment-464995 Share on other sites More sharing options...
sasa Posted February 12, 2008 Share Posted February 12, 2008 can we see form part Quote Link to comment https://forums.phpfreaks.com/topic/90716-php-error/#findComment-465000 Share on other sites More sharing options...
pyke96 Posted February 12, 2008 Author Share Posted February 12, 2008 can we see form part <form method = "post" action = "add_pat.php"> <fieldset> <legend>Add Patients Details</legend> <p> <label for="firstname" class ="fixed_required">First Name: </label> <input type="text" name="firstname" id="firstname" value ="<?php if(isset($_POST['firstname'])) echo $_POST['firstname']; ?>"/> </p> <p> <label for="lastname" class ="fixed_required">Last Name: </label> <input type="text" name="lastname" id="lastname" value ="<?php if(isset($_POST['lastname'])) echo $_POST['lastname']; ?>"/> </p> <p> <label for="username" class ="fixed_required">User Name: </label> <input type="text" name="username" id="username" value ="<?php if(isset($_POST['username'])) echo $_POST['username']; ?>"/> </p> <p> <label for="password" class ="fixed_required">Password: </label> <input type="password" name="password" id="password" value ="<?php if(isset($_POST['password'])) echo $_POST['password']; ?>"/> </p> <p> <label for="address" class ="fixed_required">Address: </label> <input type="text" name="address" id="address" value ="<?php if(isset($_POST['address'])) echo $_POST['address']; ?>"/> </p> <p> <label for="county" class ="fixed_required">County: </label> <input type="text" name="county" id="county" value ="<?php if(isset($_POST['county'])) echo $_POST['county']; ?>"/> </p> <p> <label for="country" class ="fixed_required">Country: </label> <input type="text" name="country" id="country" value ="<?php if(isset($_POST['country'])) echo $_POST['country']; ?>"/> </p> <p class="submitbuttonarea" id = "submit"> <input type="submit" name ="submit" value="Submit" /> </p> </fieldset> </form> This is the form section of the code Quote Link to comment https://forums.phpfreaks.com/topic/90716-php-error/#findComment-465003 Share on other sites More sharing options...
Illusion Posted February 12, 2008 Share Posted February 12, 2008 might be due to same index 'address' and also I don't see session_start(); Quote Link to comment https://forums.phpfreaks.com/topic/90716-php-error/#findComment-465012 Share on other sites More sharing options...
sasa Posted February 12, 2008 Share Posted February 12, 2008 $_SESSION['username'] = $_POST['user']; change this line to $_SESSION['username'] = $_POST['username']; Quote Link to comment https://forums.phpfreaks.com/topic/90716-php-error/#findComment-465014 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.