I am having an issue validating that a field is empty or full. The code below will help.
The below is not the whole piece of my form, just the part you need to know. HTML:
<form action="" method="post" id="all_message">
<ul>
<li>
<label for="subject">Subject</label><br />
<select id="No_dropdown" name="Dropown_select">
<option value="Request for quote">Request for quote</option>
<option value="Service inquiries">Service inquiries</option>
<option value="Other">Other</option>
</select>
</li>
<li>
<input type="submit" value="Send" name="submit" />
</li>
</ul>
</form>
I use this script to make a no selection on the select option above. Javascript
<script language="javascript" type="text/javascript">
document.getElementById("No_dropdown").selectedIndex = -1;
</script>
This is not the whole PHP for it, just the part I'm having trouble with. PHP:
$subject = $_POST['Dropown_select'];
if (empty($name) === true || empty($email) === true || empty($phone) === true ||
!($subject === "Other" || "Service inquiries" || "Request for quote") ||
empty($message) === true )
This is the part I am having troubles with:
!($subject === "Other" || "Service inquiries" || "Request for quote")
I need that part to see if one of the 'dropdowns' is selected and if not give an error.