php - Validating multiple options with if statement -


i having issue validating field empty or full. code below help.

the below not whole piece of form, part need 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 quote">request 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 script make no selection on select option above. javascript

<script language="javascript" type="text/javascript"> document.getelementbyid("no_dropdown").selectedindex = -1; </script> 

this not whole php it, 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 quote") ||        empty($message) === true )  

this part having troubles with:

!($subject === "other" || "service inquiries" || "request quote") 

i need part see if 1 of 'dropdowns' selected , if not give error.

!($subject === "other" || $subject === "service inquiries" || $subject === "request quote") 

or

($subject !== "other" && $subject !== "service inquiries" && $subject !== "request quote") 

or

!in_array($subject, array("other", "service inquiries", "request quote"), true); 

Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -