Hi!
I've decided to change my code a bit but still doesn't work.After clicking "Edit" the it goes to the form below:
if($submit =="Edit")
{
?>
<h2>Insert New Information!</h2>
<form action="update.php" action="Post">
<input type=hidden name="id_no" value="<?php echo
$row["id_no"]?>">
First_name:<input type="text" name="first_name"><br>
Last_name:<input type="text" name="last_name"><br>
Tel_no: <input type="text" name="tel_no"><br>
Fax_no: <input type="text" name="fax_no"><p>
<input type="submit" name="submit" value="Edit"><p>
</form>
<?php
}
This form form will then submitted to the following code below:
if($submit =="Edit")
{
if(!$first_name||!$last_name||
!$tel_no||!$fax_no)
{
$error ="Sorry!You didn't fill in all the fields!
Please fill in the correct information !";
}
else
{
$query = "Update details set
first_name='$first_name'
,last_name='$last_name'
,tel_no='$tel_no'
,fax_no='$fax_no'
where id_no =$id_no";
$result = mysql_query($query) or
die (" echo mysql_error() ");
echo"Thank You!Your Information Is Updated";
}
}
if (!$submit || $error) {
echo $error;
?>
<p>
<form action="update.php" action="Post">
First_name:<input type="text" name="first_name"><br>
Last_name:<input type="text" name="last_name"><br>
Tel_no: <input type="text" name="tel_no"><br>
Fax_no: <input type="text" name="fax_no"><p>
<input type="submit" name="submit" value="Edit"><p>
</form>
<?php
}
?>
The problem is the part were i have to select the id_no i want to edit.
{Where id_no =$id_no}
If i specify the id_no say id_no=100;it does update the row where id_no is 100.Don't know where the problem.Can you help?
Thanx