Submit doesn't works if Action present in the form
Posted: Tue Jul 17, 2012 11:47 pm
Hi,
I have created an input form in php which will submit data to ms access2010 database and after submitting go to another page which is mentioned in form action. But if I use the url for another page in action, data don't insert into the database. If I remove the action than the data is inserted. I am giving the code bellow-
please guide me.
I have created an input form in php which will submit data to ms access2010 database and after submitting go to another page which is mentioned in form action. But if I use the url for another page in action, data don't insert into the database. If I remove the action than the data is inserted. I am giving the code bellow-
Code: Select all
<script>
function inputvalidation()
{
if (document.getElementById('Com_Name').value == '') {
alert('Insert Name');
return false; // stop submission until textbox is not ''
}
else if (document.getElementById('Email').value == '') {
alert('Insert Email');
return false; // stop submission until textbox is not ''
}
else if (document.getElementById('Address').value == '') {
alert('Insert Address');
return false; // stop submission until textbox is not ''
}
else
{
this.document.form1.mode.value='submit';
this.document.form1.submit();
}
}
</script>
<html>
<form name="form1" method="post" onSubmit="return inputvalidation()" action="proc_detail.php?id=<?php echo odbc_result($qResult_main,'Proc_ID')?>">
<table align="center" style="font-family:Verdana; font-size:11px; color:#FF0000; font-style:italic;">
<tr>
<td width="20%"></td>
<td width="80%"><input name="Deadline" type="date" id="Deadline" size="20" value="<?php echo odbc_result($qResult_main,'Proc_Deadline')?>" style="visibility:hidden"></td>
</tr>
<tr style="background-color:#D2D2F9;"><td width="20%"><b>Company Name<font style="color:#FF0000">*</font>:</b></td>
<td width="80%"><input name="Com_Name" type="text" id="Com_Name" size="70" style="font-size:12px;"></td>
</tr>
<tr style="background-color:#D2D2F9;">
<td width="20%"><b>Email<font style="color:#FF0000">*</font>:</b></td>
<td width="80%"><input name="Email" type="text" id="Email" size="70" style="font-size:12px;"></td>
</tr>
<tr style="background-color:#D2D2F9;">
<td width="20%"><b>Address<font style="color:#FF0000">*</font>:</b></td>
<td width="80%"><input name="Address" type="text" id="Address" size="120" style="font-size:12px;"></td>
</tr>
<td>
<input type="submit" name="Submit" value="Submit" class="hilite">
<input type="hidden" name="mode" value="submit">
</td>
</tr>
<td></td><td></td></tr>
</table>
</form>
</html>