[SOLVED] Testing Definitions

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
Joe
Forum Regular
Posts: 939
Joined: Sun Feb 29, 2004 1:26 pm
Location: UK - Glasgow

[SOLVED] Testing Definitions

Post 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
Last edited by Joe on Wed Feb 02, 2005 12:29 pm, edited 1 time in total.
User avatar
Joe
Forum Regular
Posts: 939
Joined: Sun Feb 29, 2004 1:26 pm
Location: UK - Glasgow

Post by Joe »

Grr, everyone ignore the previous post. I found a solution.

Thanks
Post Reply