Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    May 2008
    Posts
    446
    Thanks
    23
    Thanked 5 Times in 5 Posts

    parse error for emailform

    I am creating a script to process email forms. So far I have run into this error:

    Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/surreal/public_html/emailform.php on line 23

    This is code surrounding line 23

    20: foreach ($_POST as $key => $value) {
    21: $key = clear_user_input($key);
    22: $value = clear_user_input($value);
    23: if ($key--'extra'){
    24: if (is_array($POST['extras']))}
    25: $body .= "key: ";
    26: $counter =1;
    27: foreach($_POST['extras'] as $value) {
    28: //Add comma and space until last element
    29: if (sizeof($_POST['extras']) == $counter) {
    30: $body .= "$value\n";
    31: break;}
    32: else {
    33: $body .= "$value, ";
    34: $counter += 1;
    35: }}
    36: } else{
    37: $body .= "$key: $value\n";
    38: }

    I appreciate any help you can give me

  • #2
    Regular Coder
    Join Date
    Apr 2006
    Location
    Northbrook, IL
    Posts
    394
    Thanks
    8
    Thanked 6 Times in 6 Posts
    line 23 makes no sense, it should probably be

    Code:
    if ($key=='extra'){


  •  

    Posting Permissions

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