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> Quote Link to comment 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 Quote Link to comment 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' Quote Link to comment 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' ; Quote Link to comment 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.