Jump to content

Notice: Undefined index: name


mdvignesh

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.