mdvignesh Posted April 5, 2011 Share Posted April 5, 2011 I got this error when i click update button Notice: Undefined index: name in C:\wamp\www\mariyano\New Folder - Copy\New\update.php on line 14 Notice: Undefined index: mobile in C:\wamp\www\mariyano\New Folder - Copy\New\update.php on line 14 Notice: Undefined index: email in C:\wamp\www\mariyano\New Folder - Copy\New\update.php on line 14 Unknown column 'diwakar' in 'where clause' <?php $cn=mysql_connect("localhost","root",""); mysql_select_db("super",$cn); if(isset($_POST['submit'])) { //checks cookies to make sure they are logged in if(isset($_COOKIE['ID_my_site'])) { $username = $_COOKIE['ID_my_site']; $qy="UPDATE users SET name='$_POST[name]', email='$_POST[mobile]', city='$_POST[email]' WHERE username=$username "; mysql_query($qy,$cn) or die(mysql_error()); } } ?> <?php $cn=mysql_connect("localhost","root",""); mysql_select_db("super",$cn); //checks cookies to make sure they are logged in if(!isset($_COOKIE['ID_my_site'])) { header("Location: login.php"); } echo "<h3>Profiles</h3><br/><br/>"; echo "Name: <input type=\"text\" name=\"name\" > "; echo "<br/>"; echo "Email: <input type=\"text\" name=\"email\"> "; echo "<br/>"; echo "City: <input type=\"text\" name=\"city\"> "; //echo "<br/><br/><input type=\"submit\" value=\"Update\" >"; //echo "<br/><br/><a href=logout.php>Logout</a>"; ?> <html> <form action='update.php' method='post'> <br/> <input type='submit' name='submit' value='Update' > <br/><br/><a href=logout.php>Logout</a> </form> </html> Link to comment https://forums.phpfreaks.com/topic/232736-notice-undefined-index-name/ Share on other sites More sharing options...
spiderwell Posted April 5, 2011 Share Posted April 5, 2011 your form inputs are not inside the recommended <form> </form>. move your inputs to echo inside those tags Link to comment https://forums.phpfreaks.com/topic/232736-notice-undefined-index-name/#findComment-1197094 Share on other sites More sharing options...
mdvignesh Posted April 5, 2011 Author Share Posted April 5, 2011 your form inputs are not inside the recommended <form> </form>. move your inputs to echo inside those tags Thanks for ur help only this error now Unknown column 'diwakar' in 'where clause' Link to comment https://forums.phpfreaks.com/topic/232736-notice-undefined-index-name/#findComment-1197098 Share on other sites More sharing options...
spiderwell Posted April 5, 2011 Share Posted April 5, 2011 WHERE username=$username should be WHERE username='$username' ; Link to comment https://forums.phpfreaks.com/topic/232736-notice-undefined-index-name/#findComment-1197103 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.