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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 19, 20262026-06-19T00:14:08+00:00 2026-06-19T00:14:08+00:00

I am quite new to PHP and I am currently making a survey. Users

  • 0

I am quite new to PHP and I am currently making a survey. Users select answers to questions in the form on radio buttons. Each question has 4 possibilities and are grouped under each question. When the form is submitted, a page should show which button on each group was selected. The code at the moment is this:

<form action="thankyou.php" method="post">
  <p>How easy would you say it is to create new carers?</p>
   <input type="radio" name="rgroup1" value="rg1v1"> Excellent
   <input type="radio" name="rgroup1" value="rg1v2"> Good
   <input type="radio" name="rgroup1" value="rg1v3"> Average
   <input type="radio" name="rgroup1" value="rg1v4"> Poor</br>

  <p>How easy is it to generate a report?</p>
   <input type="radio" name="rgroup2" value="rg2v1"> Excellent
   <input type="radio" name="rgroup2" value="rg2v2"> Good
   <input type="radio" name="rgroup2" value="rg2v3"> Average
   <input type="radio" name="rgroup2" value="rg2v4"> Poor</br>

  <p>How easy is it to add and alter timesheets?</p>
   <input type="radio" name="rgroup3" value="excellent"> Excellent
   <input type="radio" name="rgroup3" value="good"> Good
   <input type="radio" name="rgroup3" value="average"> Average
   <input type="radio" name="rgroup3" value="poor"> Poor</br>

  <p>How good would you rate the Packages Of Care functions? </p>
   <input type="radio" name="rgroup4" value="excellent"> Excellent
   <input type="radio" name="rgroup4" value="good"> Good
   <input type="radio" name="rgroup4" value="average"> Average
   <input type="radio" name="rgroup4" value="poor"> Poor</br>

  <p>Question 5</p>
   <input type="radio" name="rgroup5" value="excellent"> Excellent
   <input type="radio" name="rgroup5" value="good"> Good
   <input type="radio" name="rgroup5" value="average"> Average
   <input type="radio" name="rgroup5" value="poor"> Poor</br>
   </br>
      Please  Enter Your Comments Below:
   </br></br>
        <textarea name="comments" width="100px" rows="4" cols="50" wrap="wrap"></textarea>
   </br></br>
        <input type="submit">
   <br/><br/>
</form>

and my PHP for the “thankyou.php” page is:

<?php 

switch($_POST['rgroup1']) {
    case "rg1v1":
        $value = "Radio Group 1 - Value 1 was selected.";
        break;
    case "rg1v2":
        $value = "Radio Group 1 - Value 2 was selected.";
        break;
    case "rg1v3":
        $value = "Radio Group 1 - Value 3 was selected.";
        break;
    case "rg1v4":
        $value = "Radio Group 1 - Value 4 was selected.";
        break; 

        default:
        $value = "No radio has been selected for Radio Group 1";
}

switch($_POST['rgroup2']) {
    case "rg2v1":
        $value2 = "Radio Group 2 - Value 1 was selected.";
        break;
    case "rg2v2":
        $value2 = "Radio Group 2 - Value 2 was selected.";
        break;
    case "rg2v3":
        $value2 = "Radio Group 2 - Value 3 was selected.";
        break;
    case "rg2v4":
        $value2 = "Radio Group 2 - Value 4 was selected.";
        break; 

        default:
        $value = "No radio has been selected for Radio Group 2";
}

switch($_POST['rgroup3']) {
    case "rg3v1":
        $value3 = "Radio Group 3 - Value 1 was selected.";
        break;
    case "rg3v2":
        $value3 = "Radio Group 3 - Value 2 was selected.";
        break;
    case "rg3v3":
        $value3 = "Radio Group 3 - Value 3 was selected.";
        break;
    case "rg3v4":
        $value3 = "Radio Group 3 - Value 4 was selected.";
        break; 

        default:
        $value = "No radio has been selected for Radio Group 3";
}

switch($_POST['rgroup4']) {
    case "rg4v1":
        $value4 = "Radio Group 4 - Value 1 was selected.";
        break;
    case "rg4v2":
        $value4 = "Radio Group 4 - Value 2 was selected.";
        break;
    case "rg4v3":
        $value4 = "Radio Group 4 - Value 3 was selected.";
        break;
    case "rg4v4":
        $value4 = "Radio Group 4 - Value 4 was selected.";
        break; 

        default:
        $value = "No radio has been selected for Radio Group 4";
}

switch($_POST['rgroup5']) {
    case "rg5v1":
        $value5 = "Radio Group 5 - Value 1 was selected.";
        break;
    case "rg5v2":
        $value5 = "Radio Group 5 - Value 2 was selected.";
        break;
    case "rg5v3":
        $value5 = "Radio Group 5 - Value 3 was selected.";
        break;
    case "rg5v4":
        $value5 = "Radio Group 5 - Value 4 was selected.";
        break; 

        default:
        $value = "No radio has been selected for Radio Group 5";
}


echo $value;
echo $value2;
echo $value3;
echo $value4;
echo $value5;

?>

I am getting a error saying I am not defining the variables for value2, 3, 4 and 5 and I am not sure why.

  • 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-06-19T00:14:10+00:00Added an answer on June 19, 2026 at 12:14 am

    For 3, 4, and 5 the radio section values are excellent, good, average, poor and not working. ‘rg3v1’, ‘rg3v2’, ‘rg3v3’, and ‘rg3v4’. So when execution goes into the following code,

    switch($_POST['rgroup3']) {
        case "rg3v1":
            $value3 = "Radio Group 3 - Value 1 was selected.";
            break;
        case "rg3v2":
            $value3 = "Radio Group 3 - Value 2 was selected.";
            break;
        case "rg3v3":
            $value3 = "Radio Group 3 - Value 3 was selected.";
            break;
        case "rg3v4":
            $value3 = "Radio Group 3 - Value 4 was selected.";
            break; 
    
            default:
            $value = "No radio has been selected for Radio Group 3";
    }
    
    switch($_POST['rgroup4']) {
        case "rg4v1":
            $value4 = "Radio Group 4 - Value 1 was selected.";
            break;
        case "rg4v2":
            $value4 = "Radio Group 4 - Value 2 was selected.";
            break;
        case "rg4v3":
            $value4 = "Radio Group 4 - Value 3 was selected.";
            break;
        case "rg4v4":
            $value4 = "Radio Group 4 - Value 4 was selected.";
            break; 
    
            default:
            $value = "No radio has been selected for Radio Group 4";
    }
    
    switch($_POST['rgroup5']) {
        case "rg5v1":
            $value5 = "Radio Group 5 - Value 1 was selected.";
            break;
        case "rg5v2":
            $value5 = "Radio Group 5 - Value 2 was selected.";
            break;
        case "rg5v3":
            $value5 = "Radio Group 5 - Value 3 was selected.";
            break;
        case "rg5v4":
            $value5 = "Radio Group 5 - Value 4 was selected.";
            break; 
    
            default:
            $value = "No radio has been selected for Radio Group 5";
    }
    

    it didn’t assign anything and shows an error when you try to print the following variables,

    echo $value3;
    echo $value4;
    echo $value5;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm quite new to PHP Classes and I'm currently setting up a couple of
I'm quite new to Joomla! as well as PHP. Currently i'm developing a Joomla!
I'm quite new in PHP dev and I can't find a way to solve
I'm quite new to php and have been reading Larry Ullman book to develop
I'm quite new to PHP so I don't know how to solve this error.
This is probably something really simple, however I am quite new to PHP, and
I'm new to PHP, and don't have quite the grip on how it works.
Being quite new to rails and currently building a project, i'm begining to be
There is a page that I'm currently working on ( http://www.flcbranson.org/freedownloads-new.php ) that loads
I am extremely new to PHP and, although I am quite familiar to javascript,

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.