I want user first load test.htm, choose the answer then click next to the second question. Then the result will be the sum of the two choices.
I have three problems here:
1. How can I write the CGI code to jump to second page?
2. How can I perform the calculation?
3. How can I save the results in a txt file?
Thanks very much.
[edited by: sugarkane at 7:28 pm (utc) on Oct. 27, 2003]
[edit reason] No URLs please. Thanks [/edit]
u will start your cgi as usual
#!/usr/local/bin/perl
use CGI;
my $q = new CGI;
#retreive the values
my $Value1 = $q->param('Value1');
my $Value2 = $q->param('Value2');
$Result = $Value1 + $Value2;
#now u need to write it out in a file and create ur 2nd html file, u have two options when creating the html file u can eighter create it dynamicaly then retreive it or just output the data that u wanted in the cgi itself.
#Creating the result file
open (File,">results.txt") ¦¦ die " impossible d'ouvrir data";
print File $Results;
close File;
#Output the data on the screen
print $query->start_html("The result is"); #This will be the title of ur page
print "<h1>The Result is $Results</h1>";
print "</body></html>";
that should be it i think but just in case try it out ...
.: protheus :.