Hi ,
I have a form having some text fileds and submit button. One more input box and submit button . If a value is entered in input box and button pressed then that will search data from database and displayed in text boxes ,is done . Now I want to edit data of the same displayed value which is not working .Here is the code :
<?php
$ansssa=$_POST['serno'];
$sql=("SELECT customer.customer_name, customer.dealer_name, customer.city, customer.country, customer.telephone, customer.customer_mail, reminder.reminder, reminder.expiry_date,reminder.permanent_license,reminder.limited_time_license,software_order.product_name, software_order.limit,software_order.serial_number
FROM customer
INNER JOIN reminder ON customer.serial_number = reminder.serial_number
INNER JOIN software_order ON customer.serial_number = software_order.serial_number
AND customer.serial_number ='$ansssa'");
$qry = mysql_query($sql);
$rs = mysql_fetch_array($qry)
?>
<table width="600" border="0" align="center" cellpadding="0" cellspacing="0" class="of border">
<form name="licence" action="<?php $_SERVER['PHP_SELF']?>" method="post" >
<tr>
<td><h2>Manage SSA</h2></td>
</tr>
<tr>
<td><table border="0" align="center">
<tr>
<td width="10px"> </td>
<td>Input Serial number </td>
<td><input type="text" name="serno" id="serno" width="200" /></td>
<td width="10px"> </td>
<td><input type="submit" name="search" id="search" value="Search Value" />
<input type="hidden" name="todo" id="todo" value="Search" />
<input type="hidden" name="id" value="<?php echo $rs['serial_number']; ?>"></td>
<td width="10px"> </td>
<td> </td>
</tr>
</table></td>
</tr>
<tr>
<td><table width="400" border="0" align="center" cellpadding="0" cellspacing="0">
<tr> </tr>
<tr> </tr>
</table></td>
</tr>
<tr>
<td><h2>Customer</h2></td>
</tr>
<tr>
<td><table width="400" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="190">Customer name </td>
<td width="10px">:</td>
<td><input type="text" name="txtcustomername" id="txtcustomername" class="textbox" value="<?php echo $rs['customer_name'];?>"/></td>
</tr>
<tr> </tr>
<tr>
<td>Dealer name </td>
<td>:</td>
<td><input type="text" name="txtdealername" id="txtdealername" class="textbox" value="<?php echo $rs['dealer_name'];?>"/></td>
</tr>
<tr>
<td>Customer's city </td>
<td>:</td>
<td><input type="text" name="txtcity" id="txtcity" class="textbox" value="<?php echo $rs['city'];?>"/></td>
</tr>
<tr>
<td>Country</td>
<td>:</td>
<td><input type="text" name="txtcountry" id="txtcountry" class="textbox" value="<?php echo $rs['country'];?>"/></td>
</tr>
<tr>
<td>Email for customer </td>
<td>;</td>
<td><input type="text" name="txtmail" id="txtmail" class="textbox" value="<?php echo $rs['customer_mail'];?>"/></td>
</tr>
<tr>
<td>Telephone</td>
<td>:</td>
<td><input type="text" name="txtphone" id="txtphone" class="textbox" value="<?php echo $rs['telephone'];?>"/></td>
</tr>
</table></td>
</tr>
<tr>
<td><h2>Duration</h2></td>
</tr>
<tr>
<td><h2>Software ordered</h2></td>
</tr>
<tr>
<td><table width="400" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td>Serial number</td>
<td>:</td>
<td><input type="text" name="txtsernumber" id="txtsernumber" class="textbox" value="<?php echo $rs['serial_number'];?>"/></td>
</tr>
<tr> </tr>
</table></td>
</tr>
<tr> </tr>
<tr> </tr>
<tr>
<td> </td>
</tr>
<tr>
<td><table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><a href='<?php //$_SERVER['PHP_SELF']?>?cmd=edit&id=<?php //echo $rs['serial_number'];?>'>Edit</a></td>
<!-- <td><input type="submit" name="Submit" id="Submit" value="Submit" class="submitbg" style="width:125px;" /></td>-->
<td> </td>
<td><input type="hidden" name="todo" id="todo" value="Update" /></td>
<td> </td>
<td><a href="licence.php" >Go to licence menu</a></td>
</tr>
</table></td>
</tr>
<tr>
<td> </td>
</tr>
</form>
</table>
<?php
}
if($_REQUEST['cmd'])
{
$id=$_REQUEST['id'];
$varcustomer = $_POST['txtcustomername'];
$vardealername = $_REQUEST['txtdealername'];
$varcity = $_REQUEST['txtcity'];
$varcountry = $_REQUEST['txtcountry'];
$varmail = $_REQUEST['txtmail'];
$varphone = $_REQUEST['txtphone'];
$sql = ("UPDATE customer SET
customer_name='$varcustomer',
dealer_name='$vardealername',
city ='$varcity',
country='$varcountry',
customer_mail='$varmail',
telephone='$varphone'
WHERE serial_number ='$id' ");
$result = mysql_query($sql);
echo "Thank you! Information updated.";
}
?>