Solved

Processing HTML Data With a CGI Script

Posted on 1997-07-28
2
173 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Need help in modifying Powershell script to list all File shares with everyone permission 2 71
.csv files 5 87
Need a good Angular tutorial 5 70
React or Angular? 6 52
I hope you'll find this tutorial useful and interesting. So let's try to extend Tcl with a new package.  For anyone more deeply interested please check out the book "Practical Programming in Tcl and Tk". It's really one of the best written books abo…
It is a general practice to get rid of old user profiles on a computer  in a LAN environment. As I have been working with a company in a LAN environment where users move from one place to some other place at times. This will make many user profil…
The viewer will learn how to count occurrences of each item in an array.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

912 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now