[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

7.4

PHP form submit question

Asked by mhoggatt1 in PHP Scripting Language

Tags: form, php, submit

I copied the following practice code from an Internet site. The 'Submit' isn't working properly. Why doesn't this statement work ? I saved the code as forms_5.php

if ($action == "true") { // doesn't work

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>forms_L5.php</title>
</head>
<body>
<?
$q = array(2,0,1,2,2);
$q1_bad = array("is a container for integers only",
                "name can start with a number",
                "can contain words, sentences, integers");
$q2_bad = array("a container for strings",
                "a mathematical approach to storing integers",
                '$string[x]');
$q3_bad = array("CGI", "HTML", "PHP");
$q4_bad = array("HTML & CGI", "PHP", "HTML & PHP");
$q5_bad = array("sint", "intrand", "srand");

if ($action == "true") {
  $right = 0;
  print("Thank you for taking the PHP Quiz!");

    if ($answer_1 == $q[0]) { $right++; }
    if ($answer_2 == $q[1]) { $right++; }
    if ($answer_3 == $q[2]) { $right++; }
    if ($answer_4 == $q[3]) { $right++; }
    if ($answer_5 == $q[4]) { $right++; }

  $percentage = ($right / 5) * 100;
  print("<p>You scored <strong>$percentage %</strong> on the quiz!</BODY></HTML>");
  exit;
}
?>
<FORM METHOD="POST" ACTION="forms_5.php">
<input type="hidden" name="action" value="true">
Take the PHP Week 5 Quiz<p>
Question 1: A string is ... <br>
<input type="radio" value="0" name="answer_1"><? echo($q1_bad[0]); ?>
<input type="radio" value="1" name="answer_1"><? echo($q1_bad[1]); ?>
<input type="radio" value="2" name="answer_1"><? echo($q1_bad[2]); ?>
<br>Question 2: An array is ...
<select name="answer_2">
<option selected value="0"><? echo($q2_bad[0]); ?></option>
<option value="1"><? echo($q2_bad[1]); ?></option>
<option value="2"><? echo($q2_bad[2]); ?></option>
</select>
<br>Question 3: Building a form primarily requires ...
<input type="radio" value="0" checked name="answer_3"><? echo($q3_bad[0]); ?>
<input type="radio" value="1" name="answer_3"><? echo($q3_bad[1]); ?>
<input type="radio" value="2" name="answer_3"><? echo($q3_bad[2]); ?>
<br>Question 4: This script is an example of ...
<select name="answer_4">
<option selected value="0"><? echo($q4_bad[0]); ?></option>
<option value="1"><? echo($q4_bad[1]); ?></option>
<option value="2"><? echo($q4_bad[2]); ?></option>
</select>
<br>Question 5: Before generating random numbers you use ...
<input type="radio" value="0" name="answer_5"><? echo($q5_bad[0]); ?>
<input type="radio" value="1" name="answer_5"><? echo($q5_bad[1]); ?>
<input type="radio" value="2" name="answer_5"><? echo($q5_bad[2]); ?>
<p><center><input type="submit" value="Submit"> <input type="reset" value="Reset"></center>

</FORM>
</body>
</html>
 
Related Solutions
 
Loading Advertisement...
 
[+][-]04/23/05 07:47 AM, ID: 13850359Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04/23/05 07:48 AM, ID: 13850375Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04/23/05 07:48 AM, ID: 13850377Accepted Solution

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

About this solution

Zone: PHP Scripting Language
Tags: form, php, submit
Sign Up Now!
Solution Provided By: Diablo84
Participating Experts: 5
Solution Grade: A
 
[+][-]04/23/05 07:52 AM, ID: 13850389Assisted Solution

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 30-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]04/23/05 07:55 AM, ID: 13850400Assisted Solution

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 30-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]04/23/05 07:56 AM, ID: 13850406Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04/23/05 07:57 AM, ID: 13850409Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04/23/05 07:58 AM, ID: 13850416Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04/23/05 07:59 AM, ID: 13850417Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04/23/05 01:46 PM, ID: 13851550Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04/23/05 01:49 PM, ID: 13851557Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04/23/05 02:39 PM, ID: 13851684Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04/23/05 02:44 PM, ID: 13851693Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04/23/05 02:54 PM, ID: 13851707Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04/23/05 04:16 PM, ID: 13851881Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04/23/05 04:19 PM, ID: 13851887Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04/23/05 04:19 PM, ID: 13851889Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04/23/05 04:23 PM, ID: 13851896Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04/23/05 04:23 PM, ID: 13851898Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04/23/05 04:28 PM, ID: 13851911Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04/23/05 06:30 PM, ID: 13852182Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04/23/05 06:59 PM, ID: 13852262Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091111-EE-VQP-89