Block sending form if not selected option
Place to talk about website HTM elements, CSS style and design, and get help with HTML, CSS codes.
-
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
Posts:805
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:
Similar Topics
- Block IP address
PHP - MySQL
First post
Strange activity`s (injection)
Pleasant Coursesweb,
I have whole day this visitor their is might a possibility in the code for something like...
Last post
Hello,
You can block that ip address in php, using this code:
if(strpos($_SERVER , '20.117.73') === 0) exit();
For instance, all of these...