rendered paste body#!/usr/bin/perl
use CGI;
$q = new CGI;
if (defined ($q->param)) {
$page=$q->param('next');
if ($page eq "customer") {
&customer_info; }
if ($page eq "survey") {
&survey_questions;
}
if ($page eq "hiddendata") {
&hidden_data;
}
}
else {
#print first page
&product_page;
}
sub product_page {
print $q-> header('text/html');
print $q-> start_html('Warranty and Survey');
print $q-> p("Welcome to Joe Bloe ElectronicZ");
print "Which product did you purchase from us?";
print $q-> start_form(-method=>get, -action=>'newwork.cgi');
print "<input type=hidden name=next value=customer>";
print "<li> </li>".$q-> checkbox_group(-name=>'product', -values=>['computer', 'mp3 player']);
print "<li> </li>".$q-> submit(-name=>'Submit');
print $q-> end_form;
print $q-> end_html;
}
sub customer_info {
print $q-> header('text/html');
print $q-> start_html('Warranty and Survey');
print $q-> start_form(-method=>get, -action=>'newwork.cgi');
@users_product=$q->param('product');
foreach $i (@users_product) {
print "<strong>You have selected</strong>"."<li> $i </li>";
}
print "<p>Please inform us of your details</p>";
#print "<input type=hidden name=next value=survey/>";
print "<li>Full Name: </li>".$q-> textfield(-name=>'username', -size=>'20', -maxlength=>'100');
print "<li>Gender: </li>".$q-> radio_group(-name=>'gender', -values=>['M', 'F']);
print "<li>State: </li>".$q-> popup_menu(-name=>'state', -values=>['-Please Select-', 'QLD', 'N.S.W']);
print "<li>Email: </li>".$q-> textfield(-name=>'email', -size=>'25', -maxlength=>'50');
print "<input type=hidden name=next value=survey/>";
print "<p><li> </li></p>".$q-> reset(-name=>'Reset Details');
print " ".$q-> submit(-name=>'Submit Details');
print $q-> end_form;
print $q-> end_html;
}
sub survey_questions {
print $q-> header('text/html');
print $q-> start_html('Warranty and Survey');
print $q-> start_form(-method=>get, -action=>'newwork.cgi');
print $q-> h1("Survey");
print "<input type=hidden name=next value=hiddendata/>";
print "<li>What do you rate the customer service?</li>".$q-> radio_group(-name=>'service', -values=> ['1', '2', '3', '4', '5']);
print "<li>How would you rate the price of the product?</li>".$q-> radio_group(-name=>'price', -values=> ['1', '2', '3', '4', '5']);
print "<li>What do you rate the product overall?</li>".$q-> radio_group(-name=>'product', -values=> ['1', '2', '3', '4', '5']);
print "<p> </p>".$q-> submit(-name=>'Continue');
print $q-> end_html;
print $q-> end_form;
}
#sub hidden_data {
# print $q-> header('text/html');
# print "<input type=hidden name=next value=nextone/>";
# print "hello this is hidden";
#}