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 6 of 6
  1. #1
    New Coder
    Join Date
    Mar 2004
    Posts
    92
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Parse error: syntax error, unexpected '}'

    code in the functions.php file:
    PHP Code:
    <?  
      
    //functions page
      
    function send_mail() {
        
    $my_name $_POST['first_name'].' '.$_POST['last_name'];
        
    $my_email $_POST['email'];
        
    $to_name '......';
        
    $to_email '......';
        
    $subject '.....!';
          
    $message '.....';
    ThisHTML;
        
    $mailheaders "From: $my_name <$my_email>\n";
        
    $mailheaders .= "MIME-Version: 1.0\r\n";
        
    $mailheaders .= "Content-Type: text/html; charset=iso-8859-1";
        if (!=
    mail('$to_name <$to_email>''$subject''$message''$mailheaders')) {
          echo 
    "mail couldn't be sent";
        }
      }
    ?>
    PHP Code:
    <?php
      
    include ('functions.php');
      if (
    $_POST["QuoteCheck"] == "1") {
        
    send_mail()
      } 
    //<---15th line
    ?>
    I'm getting this error: Parse error: syntax error, unexpected '}' in c:\Inetpub\wwwroot\clients\butterfly\index.php on line 15

    I have the if statement closed off.. i don't understand why i'm getting that error.... thanks for the help...

    -peace

  • #2
    Regular Coder dniwebdesign's Avatar
    Join Date
    Dec 2003
    Location
    Carrot River, Saskatchewan
    Posts
    842
    Thanks
    15
    Thanked 9 Times in 9 Posts

    Post

    I don't know if this is the problem but it helps clean it up and acutally sends teh e-mail.

    PHP Code:
    <?   
      
    //functions page 
      
    function send_mail() { 
        
    $my_name $_POST['first_name'].' '.$_POST['last_name']; 
        
    $my_email $_POST['email']; 
        
    $to_name '......'
        
    $to_email '......'
        
    $subject '.....!'
          
    $message '.....'
    ThisHTML
        
    $mailheaders "From: $my_name <$my_email>\r\n"
        
    $mailheaders .= "MIME-Version: 1.0\r\n"
        
    $mailheaders .= "Content-Type: text/html; charset=iso-8859-1"
        
    $mail=mail('$to_name <$to_email>''$subject''$message''$mailheaders')
        
        if (!
    $mail) { 
          echo 
    "mail couldn't be sent"
        } 
        else
        {
            echo 
    "Mail Sent";
        }
      } 
    ?>
    <edited: added } as I was missing it>
    Last edited by dniwebdesign; 09-24-2004 at 06:55 AM.
    Dawson Irvine
    CEO - DNI Web Design
    http://www.dniwebdesign.com

  • #3
    New Coder
    Join Date
    Mar 2004
    Posts
    92
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks for helping me clean up that section of coding.. I'm still getting that parse error though... Can anyone else give me a hand?

    -peace

  • #4
    Senior Coder
    Join Date
    Aug 2003
    Location
    One step ahead of you.
    Posts
    2,815
    Thanks
    0
    Thanked 3 Times in 3 Posts
    You are missing a ";" in the line above.

  • #5
    Senior Coder Nightfire's Avatar
    Join Date
    Jun 2002
    Posts
    4,265
    Thanks
    6
    Thanked 48 Times in 48 Posts
    This is the 'line above'

    $mail=mail('$to_name <$to_email>', '$subject', '$message', '$mailheaders');

    You do also realise that the email won't be sent, dont you? Variables inside single quotes ( ' ) don't get parsed. You need to use double quotes ( " )

    $mail=mail("$to_name <$to_email>", "$subject", "$message", "$mailheaders");

  • #6
    Regular Coder dniwebdesign's Avatar
    Join Date
    Dec 2003
    Location
    Carrot River, Saskatchewan
    Posts
    842
    Thanks
    15
    Thanked 9 Times in 9 Posts
    PHP Code:
    <?    
      
    //functions page 
      
    function send_mail() 
      {  
        
    $my_name $_POST['first_name'].' '.$_POST['last_name'];  
        
    $my_email $_POST['email'];  
        
    $to_name '......';  
        
    $to_email '......';  
        
    $subject '.....!';  
        
    $message '.....';  
        
    ThisHTML;  
        
    $mailheaders "From: $my_name <$my_email>\r\n";  
        
    $mailheaders .= "MIME-Version: 1.0\r\n";  
        
    $mailheaders .= "Content-Type: text/html; charset=iso-8859-1";  
        
    $mail=mail("$to_name <$to_email>""$subject""$message""$mailheaders"); 
        if (!
    $mail
        {  
          echo 
    "mail couldn't be sent";  
        }  
        else 
        { 
          echo 
    "Mail Sent"
        } 
      }  
    ?>
    PHP Code:
    <?php 
      
    include ('functions.php'); 
      if (
    $_POST["QuoteCheck"] == "1"
      { 
        
    send_mail() ;
      } 
    //<---15th line 
    ?>
    Dawson Irvine
    CEO - DNI Web Design
    http://www.dniwebdesign.com


  •  

    Posting Permissions

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