Question : How to generate a printable form from html/php?

I'm new to PHP and need to be pointed in the right direction. I want to create an html or php-based form where users will make selections from drop-down lists, radio buttons, and enter text. Upon completing the form, I'd like the user to click a Submit button and then have the form present itself in a printable format with the options they chose (do not want to see the actual controls, but only the values selected). The user will then print the form and hand it in.

Can anyone point me to some sample code, how-to info, etc. on this topic?

Thx.

Answer : How to generate a printable form from html/php?


Quick Form Method:

Collects information and prints it, using the form "name" as the field name for the printout.

Obviously you can add dropdowns or radio buttons as required

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Your Form</title>
</head>
<body>
<? if($_POST['submit']){
echo" You Entered the Following: ";
  while (list($a, $value) = each ($_POST)){
     if($a!="submit"){
     $a=str_pad($a,20,".");// pads the length of the name
     $value=strip_tags($value);
     $a=str_replace("_", " ", $a);//removes underscored from variable names
     $a=ucwords($a);  // capitalizes the names
     echo "<pre>$a $value</pre>";
$e_var.="$a $value\n\r";  //This packs the same information into a variable that can be emailed (with additonal code)
     }
  }
  echo"</body></html>";
die;
}
echo "<h3>Form Name</h3> <form method=\"post\" name=\"FormBox1\" action=".$_SERVER["PHP_SELF"]." enctype=\"multipart/form-data\" target=\"_self\" >";
  ?>
<p>Fill out the form below<br></p>
<label for="cf_name"><B>First Name</B></label>
<br><input type="text" name="First_Name" id="cf_name" size="30" maxlength="50" ><br>
<label for="cl_name"><B>Last Name</B></label>
<br><input type="text" name="Last_Name" id="cl_name" size="30" maxlength="50" ><br>
<label for="cemail"><B>Email Address</B></label>
<br><input type="text" name="email" id="cemail" size="60" maxlength="90"  ><br>
<label for="ccomment"><B>Your Message</B></label>
<br>
<textarea cols="40" rows="10" name="comment" id="ccomment"></textarea><br><br>
<input type="submit" name="submit" id="submit" value="Print Your Results">
</form>
</body>
</html>

Random Solutions  
 
programming4us programming4us