I usally try my self but brand new with php everyone else did perl in my class but me so Im screwed with no ideas. Maybe somone can do this with comments lots of them please means a lot its actualy a no mark assignment but I want learn it still..

(1) Create an HTML form with 6 textboxes:
• Student Name
• Gender (M/F)
• Test 1 Score
• Test 2 Score
• Test 3 Score
• Test 4 Score

All test scores are out of 100

Test weights are 15%, 20%, 25%, 40% respectively

(2) Create a PHP script that reads these test scores and returns:
• Student Name followed by 3 spaces and either (Male) or (Female)
• Use the switch statement to convert m/f male/female
• The 4 Test Scores
• Average
• Letter Grade (A, B, C, D, X)
o A >= 80
o B >= 70
o C >= 60
o D >= 50
o X < 50

Thanks!

    for this assignment

    Why...? If it's an assignment, most people won't help you...

    The first part is easy, if you know HTML, it's easy.

    The second part, it's basic reading the manual and applying what you know:
    $_POST // To deal with the posted form
    [man]switch/man // For the "switch" statement
    Arithmatic // For computing grades
    [man]if/man // To deal with the grade scale

      ahh cool think did it right maybe can let me know for html!

      <!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>Untitled Document</title>
      </head>
      
      <body>
      <form name="form1" method="post" action="">
        <p>
          <input type="name" name="Name"> 
          Name</p>
        <p>
          <input name="gender" type="radio" value="gender_M">
          <b>M</strong>ale    
      <input name="gender" type="radio" value="gender_F"> <b>F</strong>emale </p> <p> <input type="text" name="test_1"> Test 1 Score </p> <p> <input type="text" name="test_2"> Test 2 Score</p> <p> <input type="text" name="test_3"> Test 3 Score</p> <p> <input type="text" name="test_4"> Test 4 Score</p> <p> <input type="submit" name="Submit" value="Submit"> <input type="Reset" name="Submit" value="Reset"> </p> </form> </body> </html>

        HTML looks okay, execpt you need to have the action value point ot the PHP page for processing...

          bpat1434 wrote:

          HTML looks okay, execpt you need to have the action value point ot the PHP page for processing...

          yeah well thats where I'm screwed :rolleyes:

            read the php manual... it really tells you all you need to know....

              bpat1434 wrote:

              read the php manual... it really tells you all you need to know....

              and what do I need to know lol

                Well, everything in my first post, and possibly on concatenation, but it's not necessary (i.e. you can do without it...)

                  its confusing without an example I don't know how or when to use these not even what order looks of what it be I got 0 experince in programming.

                    Well, you need to get stuff from the form, so you'd need to use $_POST first....

                    Then you'd need to switch between m/f and male/female (or whatever that is)

                    Then you'd need to display ([man]echo[/man]) the 4 test scores

                    Then you'd need to do arithmatic and average the scores

                    Then either switch to give the letter grade, or do a series of if/else statements....

                      Create a php file called grade.php and change your form action="" to action="grade.php"

                      <?php
                      /* The first thing to do is extract the $_POST variable that form sends to the php page */
                      $name = $_POST['Name'];
                      $gender = $_POST['gender'];
                      $test_1 = $_POST['test_1'];
                      $test_2 = $_POST['test_2'];
                      $test_3 = $_POST['test_3'];
                      $test_4 = $_POST['test_4'];
                      
                      /* The next thing is convert the m/f form input into Male / Female using a switch statement */
                      
                      switch ($gender) {
                      case "gender_M":
                         $gender = "Male";
                         break;
                      case "gender_F":
                         $gender = "Female";
                         break;
                      }
                      
                      /* Now to work out test scores based of test weights  */
                      
                      /* assign weights to variables */
                      $w1 = 15;
                      $w2 = 20;
                      $w3 = 25;
                      $w4 = 40;
                      
                      /* work out the average test score */
                      $average = ($test_1 + $test_2 + $test_3 + $test_4) / 4;
                      
                      /* Work out the weights */
                      $t1 = $w1 * ($test_1 / 100);
                      $t2 = $w2 * ($test_2 / 100);
                      $t3 = $w3 * ($test_3 / 100);
                      $t4 = $w4 * ($test_4 / 100);
                      
                      /* Add weight calculations to gain overall score */
                      $overall = $t1 + $t2 + $t3 + $t4;
                      
                      /* Convert overall score into grade score */
                      if ($overall > 80) {$grade = "A";}
                      if ($overall > 70) {$grade = "B";}
                      if ($overall > 60) {$grade = "C";}
                      if (($overall > 50) or ($overall = 50)) {$grade = "D";}
                      if ($overall < 50) {$grade = "X";}
                      
                      /* Now to output all the data to the browser */
                      echo "NAME : ".$name."&nbsp;&nbsp;&nbsp;"."(".$gender.")"."<br />";
                      echo "Test Scores<br />";
                      echo "Test 1 : ".$test_1."%<br />";
                      echo "Test 2 : ".$test_2."%<br />";
                      echo "Test 3 : ".$test_3."%<br />";
                      echo "Test 4 : ".$test_4."%<br />";
                      echo "Average : ".$average."%<br />";
                      echo "Overall Grade : ".$overall."%"."(".$grade.")";
                      ?>
                      
                      
                        Write a Reply...