Solved

Processing HTML Data With a CGI Script

Posted on 1997-07-28
2
178 Views
Last Modified: 2013-12-25
I'm trying to pass radio button data from an HTML page through a CGI script to interrogate the data and set a variable. I'm receiving the following error message:

    CGI Error

    The specified CGI application misbehaved by not returning a        
    complete set of
    HTTP headers. The headers it did return are:

    syntax error at d:\inetpub\www0244\cgi-bin\invoice2.cgi line 100,  
    near "if"
    Execution of d:\inetpub\www0244\cgi-bin\invoice2.cgi aborted due to
    compilation

The script code that was added to read the HTML radio button data is:

sub GetCart {

&ReadParse(*input);

if ($input{'r1'} eq "S1") {
        $price = 59;
        }
else
        if ($input{'r1'} eq "S2") {
                $price = 149;
                }
        else {
                $price = 399}
        }

The HTML statement is:

<form action="http://209.12.95.44/cgi-bin/invoice.cgi"
method="POST">
    <input type="hidden" name="q1" value="1"><input type="hidden"
    name="q2" value="1"><input type="hidden" name="q3" value="1"><p
    align="left"><font color="#FF0000" size="3"><em><b>I want to
    purchase the following Subscription from TRC!</b></em></font></p>
    <p align="left"><font size="3"><input type="radio" name="r1"
    value="S1"><strong>One Month @ only $59</strong><br>
    <input type="radio" name="r1" value="S2"><strong>Three months
    @ only $149</strong><br>
    <input type="radio" name="r1" value="S3"><strong>One Year @
    only $399</strong><br>
    </font></p>
    <p><font size="3"><input type="submit" name="Submit"
    value="Send">- Select to Send the order
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input
    type="reset" value="Clear">- Select to Clear the order</font></p>
</form>

I don't see the syntax error.  Do you?  Can something else be wrong?
0
Comment
Question by:trcenter
2 Comments
 
LVL 7

Accepted Solution

by:
faster earned 50 total points
ID: 1829459
The syntax is wrong, should add a {} around the "else" like this:

sub GetCart {
  &ReadParse(*input);
  if ($input{'r1'} eq "S1") {
    $price = 59;
  } else  {
    if ($input{'r1'} eq "S2") {
      $price = 149;
    } else {
      $price = 399;
    }
  }
}
 
0
 

Author Comment

by:trcenter
ID: 1829460
Thank you
0

Featured Post

Space-Age Communications Transitions to DevOps

ViaSat, a global provider of satellite and wireless communications, securely connects businesses, governments, and organizations to the Internet. Learn how ViaSat’s Network Solutions Engineer, drove the transition from a traditional network support to a DevOps-centric model.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you get a (Blue Screen of Death), your system writes a small file called a minidump. Your first step is to make certain your computer is setup to record memory dumps. Right click My Computer, choose properties. Click on the advanced tab, an…
Batch, VBS, and scripts in general are incredibly useful for repetitive tasks.  Some tasks can take a while to complete and it can be annoying to check back only to discover that your script finished 5 minutes ago.  Some scripts may complete nearly …
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question