Menu

Parse Error v 2.04

Help
2003-01-16
2003-01-16
  • Joel T Hjalmarsson

    Hi

    I'm using ver 2.04 and phpdev on a win machine. When I build a form with 2 text areas and have it all well and done and then try it out it says:

    Parse error: parse error, expecting `T_VARIABLE' or `'$'' in c:\phpdev\www\process.php on line 6

    This is after I have built a for with 2 text areas and nothing else just for testing. The code looks like this:

    <?php
    include("global.inc.php");
    $errors=0;
    $error="The following errors occured while processing your form input.<ul>";
    pt_register('POST','1');
    $1=preg_replace("/(\015\012)|(\015)|(\012)/","&nbsp;<br />", $1);pt_register('POST','2');
    $2=preg_replace("/(\015\012)|(\015)|(\012)/","&nbsp;<br />", $2);if($errors==1) echo $error;
    else{
    $where_form_is="http".($HTTP_SERVER_VARS["HTTPS"]=="on"?"s":"")."://".$SERVER_NAME.strrev(strstr(strrev($PHP_SELF),"/"));
    $message="1: ".$1."
    2: ".$2."
    ";
    mail("asfasdf@asdds.se","Form Submitted at your website",$message,"From: phpFormGenerator");
    $link = mysql_connect("localhost","root","");
    mysql_select_db("hrm",$link);
    $query="insert into clients (table1,table2) values ('".$HTTP_POST_FILES['1']['name']."','".$HTTP_POST_FILES['2']['name']."')";
    mysql_query($query);
    header("Refresh: 0;url=http://127.0.0.1");
    }
    ?>

    The parse error is on line 6. Any ideas
    Cheers

     
    • Musawir Ali

      Musawir Ali - 2003-01-16

      Please don't use numbers as your field names. A field name should start with a letter.

       
      • Joel T Hjalmarsson

        ohh we'll I missed that I shall try and come back.. Sorry for the dumb misstake

         
        • Joel T Hjalmarsson

          Ok so now it works so far but after submitting it won't get it into the database. It does not give me any error but I cannot find anythying in the database.

          <?php
          include("global.inc.php");
          $errors=0;
          $error="The following errors occured while processing your form input.<ul>";
          pt_register('POST','Name');
          pt_register('POST','Lotsoftext');
          $Lotsoftext=preg_replace("/(\015\012)|(\015)|(\012)/","&nbsp;<br />", $Lotsoftext);if($errors==1) echo $error;
          else{
          $where_form_is="http".($HTTP_SERVER_VARS["HTTPS"]=="on"?"s":"")."://".$SERVER_NAME.strrev(strstr(strrev($PHP_SELF),"/"));
          $message="Name: ".$Name."
          Lots of text: ".$Lotsoftext."
          ";
          $link = mysql_connect("localhost","root","");
          mysql_select_db("hrm",$link);
          $query="insert into testtable (name,textmass) values ('".$HTTP_POST_FILES['Name']['name']."','".$HTTP_POST_FILES['Lotsoftext']['name']."')";
          mysql_query($query);
          header("Refresh: 0;url=http://127.0.0.1");
          }
          ?>

          It works when I hit send but thisng ends up in the database

           
    • Joel T Hjalmarsson

      Well look at that, it works ... No numbers and then it works. Would that be no numbers at all or could it be "something_1" or should I skip numbers

       
    • Musawir Ali

      Musawir Ali - 2003-01-16

      you can use numbers, but you can't start a field name with a number. This is a general programming rule, you cannot name identifiers starting with numeric digits.

       
    • Musawir Ali

      Musawir Ali - 2003-01-16

      aah rats, u've found a bug :P wait.. fixing

       
    • Joel T Hjalmarsson

      What ? You mean that I have found a bug *feels proud* I'll be waiting right here :-)

       
    • Musawir Ali

      Musawir Ali - 2003-01-16

      heh yea.. I had to release 2.04 quickly cuz people were bombarding me with emails :P But anyway, stick around .. I'll have this lil thing fixed and upload the new packages

       
    • Joel T Hjalmarsson

      I'll be waiting right here.....

       
    • Musawir Ali

      Musawir Ali - 2003-01-16

      Ok all done. The new file is called phpFormGen-php-2.04b.tar.gz or phpFormGen-php-2.04b.zip , depending on which archive you'll be downloading (notice the 'b').
      It might take a little time for sourceforge to show the new files.. I can seem up right now though.

       
    • Joel T Hjalmarsson

      ok will try and get back to you

       
    • Joel T Hjalmarsson

      Ok it works, now I will try this with a online questionare that i need to build with about 40 questions all multiple choice.

      I'll inform you how i went

       
    • Joel T Hjalmarsson

      FYI Everything works fine and I have tested several different ways of doing a online form. I have no problems so far. Thanks for the fix.

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.