php form conditional checkboxes

Jennilelane

New Member
I have made a php form that is submitted by email. I am trying to make conditional check boxes so that if one specific check box is selected two others cannot be selected and if one or two of those two check boxes are selected the first one cannot. My code looks like this\[code\]<p>Ribeye Steak <input type="checkbox" name="Ribeye steak" value="http://stackoverflow.com/questions/3661988/Ribeye Steak"/> </p><p>Ribeye Roast (prime rib) <input type="checkbox" name="Ribeye Roast" value="http://stackoverflow.com/questions/3661988/ribeye roast" /> </p><p>Sirloin Steak <input type="checkbox" name="Tenderloin roast" value="http://stackoverflow.com/questions/3661988/Tenderloin roast" /> </p><p>T-bone steak <input type="checkbox" name="T-bone" value="http://stackoverflow.com/questions/3661988/T-bone steak" /> or New York Strip steak <input type="checkbox" name="NY" value="http://stackoverflow.com/questions/3661988/New York Strip" /> and/or Tenderloin Filets <input type="checkbox" name="Filets" value="http://stackoverflow.com/questions/3661988/Filets steaks" /> </p><?phpif($_GET['T-bone steak'] == 'T-bone steak' AND $_GET['New York Strip'] == 'New York Strip') { echo "You cannot select T-bone steak and NY Stip or Tenderloin. Please select T-bone or NY Strip and/or Tenderloin."; } else if($_GET['T-bone steak'] == 'T-bone steak' AND $_GET['Filets steaks'] == 'Filets steaks'){ echo "You cannot select T-bone steak and NY Stip or Tenderloin. Please select T-bone or NY Strip and/or Tenderloin."; } else{ }?>\[/code\]When the file is opened nothing happens. It still allows me to select any or all three of the checkboxes. Any ideas? Thank a bunch.
 
Back
Top