Loading ...
Sorry, an error occurred while loading the content.
 

"Possible attempt to separate words with commas

Expand Messages
  • oykusualaca
    Hi all; I ve been trying to find out what i m doing wrong but couldn t.Why am I keep receiving these messages back to back ?Any idea? Possible attempt to
    Message 1 of 3 , Mar 2, 2004
      Hi all;

      I've been trying to find out what i'm doing wrong but couldn't.Why
      am I keep receiving these messages back to back ?Any idea?

      "Possible attempt to separate words with commas at ./stage3.cgi line
      10.
      "syntax error at ./stage3.cgi line 10, near "print "<h3>These are
      our products:</h3>"

      here is my code
      ********

      #!/usr/bin/perl -wT
      use CGI qw:standard/;
      print header();
      print start_html"This is my stage3";
      print "<center>\n";
      if (request_method () eq "GET")

      {
      open PROD ,"products.db";
      print "<h3>These are our products:</h3>\n";
      #these below three lines are in a seperate form for checkout purpose
      print qq~<form method ="PSOT"action ="cgi-bin/pr3stage3.cgi">\n~;
      print qq~<input type="submit" name="submit" value="CHECK OUT">\n~;
      print "</form>\n";

      print <"table border=1 bordercolor=blue>\n;
      while (<PROD>>)

      {
      chomp;
      @fields=split / \ # / ;
      #Each record will be a self contained fprom used for updating records

      print qq~\t<tr>\n~;
      print qq~\t\t<td><form method="post" action="/cgi-
      bin/pr3/stage3.cgi">\n~;
      print qq~ \t\t\t <img src="impath$fields[3]">\n~;
      print qq~\t\t\t<td><b>Product
      ID:$fields[0]</b><br><b>Name:</b>$fields[1]<br>\n~;
      print qq~\t\t\t<b>Price:</b>$fields[3]<br>\n~;
      print qq~\t\t<td><br>\n~;
      print qq~\t\t\t<input type="submit" value="Add to Card"
      name="submit"><p>\n~;
      print qq~\t\t\t<input type="hidden" name="key" value="$fields
      [0]"><p>\n~;
      print qq~</form>\n~;
      }
      print "</table>\n";
      }
      #This request is an update is in progress
      elseif (request_method() eq "POST")
      if (param('submit') eq "Add to Card" )
      #copy checked line to a new cart.dat file

      {
      open PROD, "products.dat";
      open CARD,">>cart.dat";
      seek (CART, 0,2);

      while (<PROD>)
      {
      chomp;
      @fields=split /\ # /;
      #This tried to locate the desired record
      if ($fields[0] eq param('key')
      {
      print CARD qq~$fields [1] | $fields[2]\n~;
      }
      }
      close CART;
      close PROD;
      print "The selected item was added to the cart<br>\n";
      print"<h3>TAHNKS</h3><br>\n";
      print qq~<a href="http://zenit.senecac.on.ca:6480/cgi-
      bin/pr3/stage3.cgi">Back
      to shopping</a><br>\n~;

      print qq~<form method="post" action ="cgi-bin/pr3/stage3.cgi">\n~;
      print qq~<input type=submit" name ="submit" value="CHECK OUT">\n~;
      print "</form>\n";

      #--------------------------------------------------------------------
      ------------

      in case of LOGIN

      if (param('submit') eq "LOGIN")
      {
      $cust_name=param("LoginName");
      $cust_ccard=param("CustCard");
      if ($cust_name ! ~ / ^ \ w+ $ / ) {
      print qq ~ERROR the name msut be a alphabetic
      <br>\n~;
      $flagCard="problem";
      }
      if (flagName ne "problrm " && $flagCard ne "problem") {
      #--$cust_password=param(LoginPassword);
      print qq~Now you can check out <br>\n~;
      print qq~<form method="POST" action="/cgi-bin/pr3/stage3.cgi">\n~;
      print qq ~<input type="hidden" name="logname" value="$cust_name">\n~;
      print qq~<input type="hidden" name ="ccard" value="$ccard">\n~;
      print qq~<input type="submit" name ="submit" value="CHECK OUT">\n~;
      print "</form>\n";
      }
      }

      #----------Below code will be executed if a customer clicked CHECK
      OUT button

      if (param('submit') eq "CHECK OUT")
      {
      print qq~</center><br>\n~;
      open CUST,"customer.db";
      while (<CUST>)
      {
      chomp;
      @customers =split / \ | / ;
      if ($customers [1] eq param ("logname") &&
      $customers [7] eq param ("ccard"))
      {
      print qq~ <b>This invoice is issued to the following
      customer</b><p>\n~;
      print qq ~----------------------------------------
      <br>\n~;
      print qq
      ~Name:...................................$customers[1]<br>\n~;
      print qq ~Credit Card
      Number:...................................$customers[2]<br>\n~;
      #print qq
      ~City:...................................$customers[3]<br>\n~;
      #print qq
      ~Province:...................................$customers[4]<br>\n~;
      #print qq ~Postal
      Code:...................................$customers[5]<br>\n~;
      #print qq ~E-
      mail:...................................$customers[6]<br>\n~;
      print qq~--------------------------------------
      <br>\n~;
      }
      }
      if (param("logname") eq "")
      {
      print qq~<h3>SORRY<h3><br>\n~;
      print qq~You are not registered in our database<br>\n~;
      print qq~<form method="POST" action="/cgi-
      bin/pr3/stage3.cgi">\n~;
      print qq~Login Name----------------------------<input
      type="text
      name="LoginName"><br>\n~;
      print qq ~Credit Card Number:--------------------------------
      ----------<input
      type="text" name="CustCard"><br>\n~;
      print qq~<input type = "submit" name="submit"
      value="LOGIN">\n~;
      print "</form>\n";
      }
      close CUST;
      open CHECK,"cart.dat";
      while (<CHECK>)
      {

      chomp;
      @fields=split/ \ | / ;
      #just checking if the desired quanitity conflicts
      with the quantity in stock
      #if Q_desired is > Q_stock then sold will be Q_stock
      #time to do math
      #$money=$fields[2] * sold;
      $money=$fields[1];
      #total_ money=$total_money + $money;
      #---print invoice
      print qq~You
      bought :..................$fields[0]<br>\n~;
      print qq~Unit
      Price:.......................\$$fields[1]<br>\n~;
      #print qq~total quantity:........$fields[3]
      <br>\n~;
      #print qq~total price:........$money<br>\n~;
      }
      $gst=$money * 0.15;
      print qq~TAX (15%) is :...........$gst <br>\n~;
      $total =$gst + $money;
      print qq~............<br>\n~;
      print qq~Total charge is :.............$total
      <br>\n~;
      print qq~...........>br>\n~;
      print qq~<h3>Thank you</h3><br>\n~;
      rename "Cart.dat" , "" ;
      close CHECK;
      }
      #}
      #Finish up and clelanup
      print "</center>\n";
      print end_html( ) ;
      close PROD;
      print "\n";
    • Charles K. Clarkson
      ... Add: use strict; ... The line above is causing this error. use CGI qw/:standard/; [snip] HTH, Charles K. Clarkson -- Mobile Homes Specialist 254 968-8328
      Message 2 of 3 , Mar 2, 2004
        oykusualaca <oykusualaca@...> wrote:
        :
        : I've been trying to find out what i'm doing wrong but
        : couldn't.Why am I keep receiving these messages back to
        : back ?Any idea?
        :
        : "Possible attempt to separate words with commas at ./stage3.cgi line
        : 10.
        : "syntax error at ./stage3.cgi line 10, near "print "<h3>These are
        : our products:</h3>"
        :
        : here is my code
        : ********
        :
        : #!/usr/bin/perl -wT

        Add:

        use strict;


        : use CGI qw:standard/;

        The line above is causing this error.

        use CGI qw/:standard/;

        [snip]

        HTH,

        Charles K. Clarkson
        --
        Mobile Homes Specialist
        254 968-8328
      Your message has been successfully submitted and would be delivered to recipients shortly.