Page 1 of 1

[SOLVED] Testing Definitions

Posted: Wed Feb 02, 2005 12:23 pm
by Joe
I am having a small problem with my code and I am unable to find a quick solution. I am trying to loop through each one of the definitions to check if it is empty however, instead of doing that it gives the following error:
Parse error: parse error, unexpected T_STRING, expecting T_VARIABLE or '$' in /home/.sites/78/site85/web/register.php on line 20
My code is as follows:

Code: Select all

if ($HTTP_GET_VARSї'action'] == 1) {

  //Define 'FORM POSTED' contents
  define('INPUT_VAR_1', $HTTP_POST_VARSї'fullname']);
  define('INPUT_VAR_2', $HTTP_POST_VARSї'email']);
  define('INPUT_VAR_3', $HTTP_POST_VARSї'birth']);
  define('INPUT_VAR_4', $HTTP_POST_VARSї'location']);
  define('INPUT_VAR_5', $HTTP_POST_VARSї'city']);
  define('INPUT_VAR_6', $HTTP_POST_VARSї'phone']);
  define('INPUT_VAR_7', $HTTP_POST_VARSї'address1']);
  define('INPUT_VAR_8', $HTTP_POST_VARSї'postcode']);

   for ($i=0; $i<8; $i++) &#123;
     if (empty(INPUT_VAR_$i)) &#123;
      //Display an error if any required fields were missed
      DisplayError("It appears that you have not filled in all of the required fields. Please go back and try again!.");
      exit;
     &#125;
    else &#123;
     prepare_db_input(INPUT_VAR_$i); //Prepare table input to avoid security issues
     
     $sql_query = "INSERT INTO tbl_registration VALUES('INPUT_VAR_1', 'INPUT_VAR_2', 'INPUT_VAR_3', 'INPUT_VAR_4', 
'INPUT_VAR_5', 'INPUT_VAR_6', 'INPUT_VAR_7', 'INPUT_VAR_8')";

    $result = mysql_query($sql_query) or die(mysql_error());
   &#125;
 &#125;
&#125;
P.S: Line 20 is <?php if (empty(INPUT_VAR_$i)) { ?>

Thanks

Posted: Wed Feb 02, 2005 12:29 pm
by Joe
Grr, everyone ignore the previous post. I found a solution.

Thanks