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 7408299
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T05:53:22+00:00 2026-05-29T05:53:22+00:00

I was making a little test html/php form. Everything is fine here… but the

  • 0

I was making a little test html/php form. Everything is fine here… but the radio buttons are acting strange. Here is the code and below will be a screenshot of the weird behaviour:

The HTML

<!DOCTYPE html>
<html>
    <head>
    </head>

    <body>
        <h1>Differend sided dice</h1>
        <form action="dice.php" method="post">
        <input type="radio"   value="4" name="4side" checked  />4 side<br />
        <input type="radio"   value="10"name="10side" />10 side<br />
        <input type="radio"   value="20"name="20side" />20 side<br />
        <input type="submit" >
        </form>
    </body>
</html>

The PHP

<html><head></head>
<body>
<?

    function rollOut($dice)  {
        $out = <<<HERE
        <p>You rolled <span style="color:red"> $dice </span> of the diec</p>
HERE;
        return $out;
        }

    function diceSide() {
        $dicetype = rand(1, 10); /* default */
        if ( isset($_POST["4side"] ) ) {
            $dicetype = rand(1, $_POST["4side"] );
            print rollOut($dicetype);
            }
        else if ( isset($_POST["10side"]) ) {
            $dicetype = rand(1, $_POST["10side"] );
            print rollOut($dicetype);
            }
        else if ( isset($_POST["20side"]) ) {
            $dicetype = rand(1, $_POST["20side"]); 
            print rollOut($dicetype);
            }
        else { 
        $dicetype = rand(1, 20);
        rollOut($dicetype);
        }
    }

    /* init main */
    diceSide(); 

    ?>
</body>
</html>

And the weird thing I`ll attach to a screenshot:
bug

All buttons act like checkboxes??? Any info?

  • 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-29T05:53:23+00:00Added an answer on May 29, 2026 at 5:53 am

    you have to set the same name for all <input type='radio'> for them to act as expected

    HTML code:

    <!DOCTYPE html>
    <html>
        <head>
        </head>
    
        <body>
            <h1>Differend sided dice</h1>
            <form action="dice.php" method="post">
            <input type="radio"   value="4" name="selectMe" checked  />4 side<br />
            <input type="radio"   value="10"name="selectMe" />10 side<br />
            <input type="radio"   value="20"name="selectMe" />20 side<br />
            <input type="submit" >
            </form>
        </body>
    </html> 
    

    PHP code (i took the freedom of simplifying it a bit –should do the same thing as before, just less code):

    <html><head></head>
    <body>
    <?
    
        function rollOut($dice)  {
            $out = '<p>You rolled <span style="color:red"> '.$dice .'</span> of the diec</p>';
            return $out;
            }
    
        function diceSide() {
            $dicetype = rand(1, 10); /* default */
    
            if ( isset($_POST["selectMe"] ) ) {
                $dicetype = rand(1, $_POST["selectMe"]); 
                }
            print rollOut($dicetype);
        }
        /* init main */
        diceSide(); 
    
        ?>
    </body>
    </html>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having a little bit of trouble making a sticky form that will remember
The mechanics of making this work aren't hard, but testing it is a little
While making a little Pong game in C++ OpenGL, I decided it'd be fun
I have been making a little toy web application in C# along the lines
I am making a little GUI frontend for a app at the moment using
I'm making a little vocabulary-quiz app, and the basic model for a word is
I'm making a little message sending module. It'll handle queuing messages from a request
I'm making a little iphone game, and I would get some clues. Let's imagine:
I am just in the process of making some little demo tutorial videos for
I'm having some difficulties with the following problem: I'm making a little game where

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.