www.webdeveloper.com
Results 1 to 2 of 2

Thread: Need help with "Parse error: syntax error, unexpected '{' "

  1. #1
    Join Date
    May 2012
    Posts
    1

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

    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:
    PHP Code:
    <?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
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,401
    No parse error when I copy/paste into my editor. Maybe check if you have any extraneous non-printing characters in the actual file?
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles