I have a proper db connection where the database name is db-name,the table name is tb-name and the field names are same as the form fields: name, phone, form no, address.
I would like to avoid duplicated form entries with the same "form no", if that happen I would like to show an error and show the form again.
Please help me, thanks.
<div class="cform">
<center>
<h2>New Water Meter Application Form</h2>
</center>
<form action="submit.php<?php if($formId != ''){ echo '?update='.$formId; } ?>" method="post" name="myform" class="compform" id="myform">
<input type="hidden" name="UserName" value="<?php echo $_SESSION['UserName']; ?>" />
<ul>
<div class="part1">
<li>
<p>name:</p>
<input type="text" name="name" id="name" />
</li>
<li>
<p>phone:</p>
<input type="text" name="phone" id="phone" />
</li>
<li>
<p>Form No.:</p>
<input type="text" name="FormNo" id="FormNo" />
</li>
<li>
<p>address:</p>
<input type="text" name="address" id="address" />
</li>
</ul>
<input type="Submit" name="submit" id="Submit" value="submit" class="submit" />
</form>