We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 6004
    • 28 Posts
    I’m having trouble with a simple snippet I’m putting together to handle a contact page...Basically I’m getting the following parse error--

    Parse error: parse error, unexpected T_VARIABLE in /home/firefly1/public_html/dev/manager/includes/document.parser.class.inc.php(705) : eval()’d code on line 15

    when including a snippet called [[processForm]] on an otherwise empty page.

    processForm contains the following php--

    if ($submit) {
    
    $subject = "Contact from Firefly website";
    $headers = "From: $firstName $lastName <$email>";
    
    $to = $to . "@fireflylightinginnovations.com";
    
    $message = "Email from:" . "\r\n";
    $message .= "$firstName $lastName" . "\r\n";
    $message .= "$title" . "\r\n";
    $message .= "$company" . "\r\n";
    $message .= "$phone" . "\r\n";
    $message .= "$email" . "\r\n" . "\r\n";
    $message .= "Message:" . "\r\n\";
    $message .= "$mess";
    
    //mail($to, $subject, $message, $headers);
    echo "$to<br />$headers<br /><br />$message";
    
    echo '<h3>Thank you!</h3> <p>Your message has been sent.  Someone will contact you within 2 business days.</p>';
    
    } else {
    
    echo '<form action="" method="post">
    
    <label>Send message to:</label> <select name="to">
    	<option value=""></option>
    	<option value="sales">Sales</option>
    	<option value="engineering">Engineering</option>
    	<option value="marketing">Marketing</option>
    	<option value="service">Customer Service</option>
    </select>
    
    <input type="text" name="firstName" size="20" /> <label>First Name</label><br />
    <input type="text" name="lastName" size="20" /> <label>Last Name</label><br />
    <br />
    <input type="text" name="title" size="20" /> <label>Title</label><br />
    <input type="text" name="company" size="20" /> <label>Company Name</label><br />
    <input type="text" name="phone" size="20" /> <label>Phone Number</label><br />
    <input type="text" name="email" size="20" /> <label>Email Address</label><br />
    <br />
    <textarea name="mess" rows="10" cols="20">Please use this area to type your message.</textarea>
    
    <input type="submit" value="Send Message" name="submit" />
    
    </form>';
    
    }
    


    Can anyone spot my stupid error...I’m not seeing it. Thanks!
      • 33337
      • 3,975 Posts
      Just my 2 cents, why don’t you use eForm?
        Zaigham R - MODX Professional | Skype | Email | Twitter

        Digging the interwebs for #MODX gems and bringing it to you. modx.link
        • 32982
        • 674 Posts
        i think could be
        $message .= "$firstName.$lastName" . "\r\n";
        instead
        $message .= "$firstName $lastName" . "\r\n";
        hi
          Jabiertxof (formerly XYZVISUAL)
          My bussines: http://marker.es
          https://www.youtube.com/user/jabiertxof/videos
          • 10487 MODX Staff
          • 1,535 Posts
          Hi croakingtoad, looks like you have an extra backslash that is incorrectly escaping one of your closing quotes:
          $message .= "Message:" . "\r\n\";

          Should be:
          $message .= "Message:" . "\r\n";

          Hope that helps,
          Garry
            Garry Nutting
            Senior Developer
            MODX, LLC

            Email: [email protected]
            Twitter: @garryn
            Web: modx.com
            • 6004
            • 28 Posts
            Thanks for the help and eagle eyes.

            I am going to try eForm but I needed something quick for the client and didn’t have time to learn eForm at the time.

            Many thanks!