Block sending form if not selected option

mluci12
Posts: 39

Block sending form if not selected option

How can i block this form sending if user not select option?

Code: Select all

<form method="GET" action="search.php">
   <select name="Type">
     <option value="">---</option>
  <option value="requiment">Requiment</option>
  <option value="Available">Available</option> <br / >             
  </select>
  <select name="Type2">
     <option value="">---</option>
  <option value="sell">Sell</option>
  <option value="rent">Rent</option> <br / >             
  </select>
Search <input type="text" name="nume" id="nume" class="form-control" value="<?php if(isset($nume)) echo $nume; ?>" /><br />

Admin
Hi
Try with the "required" attribute in the form element you want to be required.
Example:

Code: Select all

<form method="GET" action="search.php">
<select name="Type" required>
<option value="">---</option>
<option value="requiment">Requiment</option>
<option value="Available">Available</option>
</select> -
<select name="Type2" required>
<option value="">---</option>
<option value="sell">Sell</option>
<option value="rent">Rent</option>
</select><br>
Search <input type="text" name="nume" id="nume" class="form-control" value="nume" required /><br>
<input type="submit" value="Submit" />

Demo:
-
Search

Adv. Posts: 01

Similar Topics