SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    May 2012
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Need help with "Parse error: syntax error, unexpected '{' " - Newbie

    Hello everyone,
    I've got a little problem with PHP script. When I upload it on server I get info that
    Parse error: syntax error, unexpected '{' in /home/b66_07/www/email2/example.php on line 22
    , as far as I know, there's a problem with "{" in line with "try{", but when I remove "{" then everything doesn't work.

    Here's my PHP code:
    Code PHP:
    <?php 
    require_once('email-txt.class.php'); 
     
     
    if($_POST['form_sended']=="1") { 
        $ObjEmailTxt = new EmailTxt(); 
    try { 
            $ObjEmailTxt->LoadFile($_FILES); 
        }catch(Exception $e){ 
            echo "<span class=error>"; 
            echo $e->getMessage(); 
            echo "</span><br>"; 
        } 
        $ObjEmailTxt->SetSender($_POST["sender"]); 
     
        if(!empty($_POST["reply_to"])) { 
            $ObjEmailTxt->SetReplyTo($_POST["reply_to"]); 
        }else{ 
            $ObjEmailTxt->SetReplyTo($_POST["sender"]); 
        } 
     
        $ObjEmailTxt->SetSubject($_POST["temat"]); 
     
        $ObjEmailTxt->SetMsg($_POST["tresc"]); 
        try { 
            $ObjEmailTxt->Send(); 
        }catch(Exception $e) { 
            echo "<span class=error>"; 
            echo $e->getMessage(); 
            echo "</span><br>"; 
        } 
     
        echo "znaleziono ".$ObjEmailTxt->ReturnCounter()." adresow email."; 
        echo "<br><br>"; 
    }

    Could anyone help me solve this?

  2. #2
    SitePoint Wizard wonshikee's Avatar
    Join Date
    Jan 2007
    Posts
    1,223
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Which line is example.php:22?

    The syntax of what I'm seeing is correct, which makes me think the problem is before the sample code (like somewhere in or above email-txt.class.php, there is no closing })


Bookmarks

Posting Permissions

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