Jump to content

Two dropdown menu's, only one needs to be selected.


Carelkat

Recommended Posts

<td>Package:</td>
	      <td><label>
	        <br />
	        <select name="b_midw" id="b_midw">
	          <option value="0">Mid Week</option>
	          <option value="1">One Round, Two Nights</option>
	          <option value="2">Two Rounds, One Night</option>
	          <option value="3">Three Rounds, Two Nights</option>
	          <option value="4">Four Rounds, Three Nights</option>
            </select>
	        <br />
	        <p>
	          
	            <select name="b_weeke" id="b_weeke">
	              <option value="0">Weekend</option>
	              <option value="1">One Round, Two Nights</option>
	              <option value="2">Two Rounds, Two Nights</option>
	              <option value="3">Three Rounds, Two Nights</option>
	              <option value="4">Four Persons, Two Golfers</option>
                </select>
            
            </p>
	        
	          <?php if ($missing && in_array('b_midw' || 'b_weeke', $missing)) { ?>
	          <span class="warning">Package?</span>
	          <?php } ?>
<?php $errors = array(); $missing = array(); if (isset($_POST['submit'])) { $to = "Carel Venter <[email protected]>"; $subject = "Booking"; $expected = array('b_name', 'b_surn', 'b_tele', 'b_mail', 'b_acco', 'b_golf', 'b_nong', 'b_midw' || 'b_weeke', 'b_courses', 'b_dfrom', 'b_dto'); $required = array('b_name', 'b_surn', 'b_tele', 'b_mail', 'b_acco', 'b_golf', 'b_nong', 'b_midw' || 'b_weeke', 'b_courses', 'b_dfrom', 'b_dto'); 

Hi there, I hope you are well.

 

I have two dropdown menus, but only one of the two needs to be selected.

 

So top of the page I have:

 

And then the menus:

 

 

 

 


<?php

$sel1 = isset( $_POST['b_midw'] ) ? (int) $_POST['b_midw'] : FALSE;
$sel2 = isset( $_POST['b_weeke'] ) ? (int) $_POST['b_weeke'] : FALSE;

if( $sel1 === FALSE && $sel2 === FALSE )
{
// Nothing selected
}
else if( $sel1 !== FALSE && $sel2 !== FALSE )
{
// Both were selected
}
else if( $sel1 !== FALSE OR $sel2 !== FALSE )
{
// One was selected
}

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.