Hi all
I would be grateful if you could help me in the following issue. I have a form on which I can recall records and modify them. On clicking on the push button 'post', the modified record is updated and a page called guarantee.php is called. But now I want to add some validation so that if there's a mistake in an input field e.g. 'tan' the message 'invalid input' is displayed and instead of calling the program guarantee.php, I am allowed to correct the mistake and post again. If all mistakes are corrected, on clicking post I should go back to guarantee.php but if not the error message should be displayed and I should be allowed to correct. Below are some codes which I have used to return to guarantee.php program after posting. It includes some functions, the description of which I have given in comment form.I have to modify these codes to allow me to correct the mistake and post again. Please help.
[PHP]<? function editrec($recid)
{
$res = sql_select(); // a function that selects the record to be edited
$count = sql_getrecordco unt(); // a function that gets the numbver of records in the table
mysql_data_seek ($res, $recid);
$row = mysql_fetch_ass oc($res);
showrecnav("edi t", $recid, $count); //a function creating the navigation tools depending on the no of records
?>
<br>
<form action="guarant ee.php" method="post" name="frmcampai gn">
<input type="hidden" name="sql" value="update"> //the value "update" of sql is passed to a function to enable update of a record
<input type="hidden" name="xBkg_Seri alNo" value="<? echo $row["Bkg_Serial No"] ?>">
<? showroweditor($ row) ?> // displays the fields to be edited
<p><input type="submit" name="action" value="Post"></p>
</form>
<?
mysql_free_resu lt($res);
} ?>[/PHP]
Thanks
I would be grateful if you could help me in the following issue. I have a form on which I can recall records and modify them. On clicking on the push button 'post', the modified record is updated and a page called guarantee.php is called. But now I want to add some validation so that if there's a mistake in an input field e.g. 'tan' the message 'invalid input' is displayed and instead of calling the program guarantee.php, I am allowed to correct the mistake and post again. If all mistakes are corrected, on clicking post I should go back to guarantee.php but if not the error message should be displayed and I should be allowed to correct. Below are some codes which I have used to return to guarantee.php program after posting. It includes some functions, the description of which I have given in comment form.I have to modify these codes to allow me to correct the mistake and post again. Please help.
[PHP]<? function editrec($recid)
{
$res = sql_select(); // a function that selects the record to be edited
$count = sql_getrecordco unt(); // a function that gets the numbver of records in the table
mysql_data_seek ($res, $recid);
$row = mysql_fetch_ass oc($res);
showrecnav("edi t", $recid, $count); //a function creating the navigation tools depending on the no of records
?>
<br>
<form action="guarant ee.php" method="post" name="frmcampai gn">
<input type="hidden" name="sql" value="update"> //the value "update" of sql is passed to a function to enable update of a record
<input type="hidden" name="xBkg_Seri alNo" value="<? echo $row["Bkg_Serial No"] ?>">
<? showroweditor($ row) ?> // displays the fields to be edited
<p><input type="submit" name="action" value="Post"></p>
</form>
<?
mysql_free_resu lt($res);
} ?>[/PHP]
Thanks
Comment