Create a form similar to assignment 9 and add 2 radio buttons and 2 check boxes. Also add two hidden fields, one has a value of 'CCSN', and one that has a value of 'CIT HTML Class'. Do a validation on the form using Java Script before submission. Create a PHP page using the the following PHP Code information.

  1. To retrieve data from a form use $inputname = $_POST['inputname'];
  2. To write data in a html page use echo($inputname);
  3. the <?php   ?> tags indicating this is a PHP script or PHP code.

Save both the response.php page and the form.html page. For preview of Sample 10 form and the out pages look here.

Sample of an PHP Page
// Beginning of Retrieving Data using PHP Script.

<?php
$VarName=$_POST['firstname']; //The input tag names of the form must agree.
$VarSchool=$_POST['school'];
$VarCourse=$_POST['course'];
$VarAge=$_POST['myage'];
$VarCkbx1=$_POST['math'];
$VarCkbx2=$_POST['art'];
$VarRadiobutt=$_POST['sex'];
?>

SAMPLE OUTPUT
HTML code
Check box 1 is <?php echo($VarCkbx1); ?> blank. The browser output would say either Check box 1 is blank. or Check box 1 is not blank. because the value of check box 1 on the form is value="not" //end of Sample PHP

You will need to add to your validation script so that you can be sure that a person selected his gender. This can be accomplished by not checking a radio button initially. Then you can test if a radio button has been selected. The following script does this job.

sex=x.sex.value;
myOption = -1;
for (i=x.sex.length-1; i > -1;i--) {
if (x.sex[i].checked) {myOption = i;}
}
if (myOption == -1) {
alert("Please specify a gender");
return false;}
  1. Your form will call your response.php page which has a Javascript Back Command for your Image.
  2. You also are required to have a return link from assignment 10 form to your index page.
  3. Link assignment 10 to your web site index page.
  4. Upload assignment 10 form.html and response.php files.
  5. Check that your form works properly.
  6. If you are having problems try calling my response.php page at http://lmlv.net/response.php to test your form, instead of your response.php page.
  7. You must do your own response page.