I have a html form. Following is my html code.
How do i selected civil status if user forgot to put other field information.
Ex: user select civil status, put first name but forgot to put last name. Then It’s show a error message “Please select your last name”. But when it’s show the error message then selected item is empty. How do i selected the civil item with php.
<tr>
<td width="400">Status</td>
<td>
<select name="civil_status">
<option value="">Select..</option>
<option value="mr.">Mr.</option>
<option value="mrs.">Mrs.</option>
<option value="miss">Miss</option>
</select>
</td>
</tr>
<tr>
<td>Last Name</td>
<td><input type="text" name="l_name" value="<?php if(isset($_POST['l_name'])) echo
$_POST['l_name']; ?>" class="tr2" /></td>
</tr>
<tr>
<td>First Name</td>
<td><input type="text" name="f_name" value="<?php if(isset($_POST['f_name'])) echo
$_POST['f_name']; ?>" class="tr2" /></td>
</tr>
I would do: