Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1066419
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T20:00:36+00:00 2026-05-16T20:00:36+00:00

I have made a php form that is submitted by email. I am trying

  • 0

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

<p>Ribeye Steak <input type="checkbox" name="Ribeye steak" value="Ribeye Steak"/> </p>
<p>Ribeye Roast (prime rib) <input type="checkbox" name="Ribeye Roast" value="ribeye roast"  /> </p>
<p>Sirloin Steak <input type="checkbox" name="Tenderloin roast" value="Tenderloin roast" /> </p>
<p>T-bone steak  <input type="checkbox" name="T-bone" value="T-bone steak" /> 
or New York Strip steak  <input type="checkbox" name="NY" value="New York Strip" /> 
and/or Tenderloin Filets <input type="checkbox" name="Filets" value="Filets steaks" /> </p>
<?php
if($_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{
          }
?>

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T20:00:37+00:00Added an answer on May 16, 2026 at 8:00 pm

    The following code should do it. It uses jQuery for handling the checkboxes’ state.

    I tested it in Firefox 3.6.8, Chrome 6.0.472.53 beta and IE 8.0.7600.16385. It’s working for me in all of them.

    <html> 
    <head> 
    
    <script src="http://code.jquery.com/jquery-latest.js"></script>
    
    <title>My Page</title>
    
    <script type="text/javascript">
     $(document).ready(function()
     {
         $('input:checkbox').click(function()
         {
                if ($('#T-bone').is(':checked'))
                {
                    $('#NY').attr("disabled", true);
                    $('#Filets').attr("disabled", true);
                }
                else
                {
                   $('#NY').attr("disabled", false);
                   $('#Filets').attr("disabled", false); 
                }
    
                if($('#NY').is(':checked') || $('#Filets').is(':checked'))
                {
                    $('#T-bone').attr("disabled", true); 
                }
                else
                {
                   $('#T-bone').attr("disabled", false); 
                }
         });
    });
    </script>
    
    </head> 
    
    <body> 
    
    <p>Ribeye Steak
    <input type="checkbox" name="Ribeye steak" value="Ribeye Steak"/>
    </p>
    
    <p>Ribeye Roast (prime rib)
    <input type="checkbox" name="Ribeye Roast" value="Ribeye Roast"  />
    </p>
    
    <p>Sirloin Steak
    <input type="checkbox" name="Tenderloin roast" value="Tenderloin roast" />
    </p>
    
    <p>T-bone steak
    <input type="checkbox" id="T-bone" name="T-bone" value="T-bone steak" /> 
    or New York Strip steak
    <input type="checkbox" id="NY" name="NY" value="New York Strip" /> 
    and/or Tenderloin Filets
    <input type="checkbox" id="Filets" name="Filets" value="Filets steaks" />
    </p>
    
    </body>
    
    </html>
    

    Edit:

    Make sure you copy the whole script tag.

    Currently your page has this (you’re missing the line $(document).ready(function() ):

    <script type="text/javascript">
    {
         $('input:checkbox').click(function()
         {
              if ($('#T-bone').is(':checked'))
              {
                   $('#NY').attr("disabled", true);
                            $('#Filets').attr("disabled", true);
              }
              else
              {
                   $('#NY').attr("disabled", false);
                   $('#Filets').attr("disabled", false); 
              }
    
              if($('#NY').is(':checked') || $('#Filets').is(':checked'))
              {
                   $('#T-bone').attr("disabled", true); 
              }
              else
              {
                   $('#T-bone').attr("disabled", false); 
              }
         });
    });
    </script>
    

    It should have this:

    <script type="text/javascript">
     $(document).ready(function()
     {
         $('input:checkbox').click(function()
         {
                if ($('#T-bone').is(':checked'))
                {
                    $('#NY').attr("disabled", true);
                    $('#Filets').attr("disabled", true);
                }
                else
                {
                   $('#NY').attr("disabled", false);
                   $('#Filets').attr("disabled", false); 
                }
    
                if($('#NY').is(':checked') || $('#Filets').is(':checked'))
                {
                    $('#T-bone').attr("disabled", true); 
                }
                else
                {
                   $('#T-bone').attr("disabled", false); 
                }
         });
    });
    </script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have made an normal form that you can enter a user´s fullname in
In a PHP module, We have a few graphics made by GD that need
I have a website built in PHP 4 with a framework made by hand
So I have made a webservice that interfaces with a set of data contained
Background I have made a Web Service in Visual Studio, and I'm trying to
I have a JavaScript class that I have made and put it into its
In a nutshell on page1.php I have a calculator that consists of an HTML
I've created a form that is made up of 2 input fields and a
I have a form that posts to a page. I want to display an
I have a simple form that has a list (dropdown list generated from a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.