So I have the following html script, and perl cgi script for a basic calculator for Apache. What I was wondering was if it is possible to add a button to the output from the cgi script, that links back to the original html file? Basically a button to start over again after the script gives you the answer. Any tips?

HTML

<html> <head> <title>Simple Calculator</title> </head> <body> <h1> Simple Calculator </h1> <form action=/cgi-bin/calc.pl method=post> <center> First Number: <input type=text name=na maxlength=4 size=4><p> Second Number (or Exponent Number): <input type=text name=nb maxlength +=4 size=4><p> Preferred mathematical operation:<br> <input type="radio" name=oper value="mul">Multiply<br> <input type="radio" name=oper value="div">Divide<br> <input type="radio" name=oper value="add">Addition<br> <input type="radio" name=oper value="sub">Subtraction<br> <input type="radio" name=oper value="expo">Exponent<br> <p> <input type="submit" value="Submit form"> <input type="reset" value-"Clear all fields"> </form> </body> </html>

Perl CGI:

#!/usr/bin/perl -w use CGI ':standard'; $na = param('na'); $nb = param('nb'); $oper = param('oper'); if ($oper eq "mul") { $answ = $na * $nb; } elsif($oper eq "div") { $answ = $na / $nb; } elsif($oper eq "add") { $answ = $na + $nb; } elsif($oper eq "sub") { $answ = $na - $nb; $nd = "-"; } else {$answ = $na ** $nb; } print "Content-type:text/html\r\n\r\n"; print "<html>"; print "<head>"; print "<title> Answer Page</title>"; print "</head>"; print "<body>"; print "<H2> The answer to your calculation is: $answ </H2>"; + print "</body>"; print "</html>";

In reply to Not sure if possible? by mwerner92

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.