here is my update link
editprofile.php?no=abc
and link us
<a href="editprofile.php?no=<?php echo $row['no'];?>">edit</a>
I need to change the name base on this row no
the php code is
<?php
if (isset($_POST['submit']))
{
$dbhost = '';
$dbuser = '';
$dbpass = '';
$conn = mysql_connect($dbhost, $dbuser, $dbpass);
if(! $conn )
{
die('Could not connect: ' . mysql_error());
}
$no=$_GET['no'];
$name=$_POST['name'];
$sql = "UPDATE tabel_name
SET name='$name'
WHERE no='$no'";
mysql_select_db('database_name');
$retval = mysql_query( $sql, $conn );
if(! $retval )
{
die('Could not update data: ' . mysql_error());
}
echo "Updated data successfully\n";
mysql_close($conn);
}
?>
<form>
<input id="edit" name="name" value="">
<input type="submit" value="submit" name="submit">
</form>
so I need to know how to change the name with new name based on no, I mean it goes to the row, based on no and rewrite the name based on new input name and redirect to the base page. The form is ok, but when I click in the link or press submit, it gives a blank entry in mysql field of name. If there is any data before edit, it rewrite and give a blank value.