Results 1 to 2 of 2

Thread: Another Variable Question

Threaded View

  1. #1

    Thread Starter
    PowerPoster lintz's Avatar
    Join Date
    Mar 2003
    Location
    The 19th Hole
    Posts
    2,697

    Resolved Another Variable Question

    When a user updates their contact details I save the changes but get an "unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING" error when using the below code.

    PHP Code:
    $field_str .= "firstname = '$_POST['firstname']', ";
    $field_str .= "lastname = '$_POST['lastname']' "
    How can I get the above to work without having to declare the variables like in the below example?
    PHP Code:
    //eg.
    $firstname $_POST['firstname'];
    $lastname $_POST['lastname'];

    $field_str .= "firstname = '$firstname', ";
    $field_str .= "lastname = '$lastname' "

    EDIT: Got it working
    PHP Code:
    $field_str .= "firstname = '$_POST[firstname]', ";
    $field_str .= "lastname = '$_POST[lastname]', "
    Last edited by lintz; Feb 23rd, 2005 at 12:41 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width