LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 01-20-2011, 12:16 AM   #1
shariefbe
Member
 
Registered: Aug 2008
Location: Tiruchirappalli, India
Distribution: UBUNTU 11.04
Posts: 368

Rep: Reputation: 31
Parse error in php code


I am novice. I am trying to create one email form. But i am getting "Parse error: parse error in F:\test\wamp\www\sendmail.php on line 43"

Code:
<?php
if(isset($_POST['email'])) {
     
    // EDIT THE 2 LINES BELOW AS REQUIRED
    $email_to = "shariefbe@gmail.com";
    $email_subject = "Inquiry from you']";
     
     
    function died($error) {
        // your error code can go here
        echo "We are very sorry, but there were error(s) found with the form you submitted. ";
        echo "These errors appear below.<br /><br />";
        echo $error."<br /><br />";
        echo "Please go back and fix these errors.<br /><br />";
        die();
    }
     
    // validation expected data exists
    if(!isset($_POST['name']) ||
        !isset($_POST['company']) ||
        !isset($_POST['email']) ||
        !isset($_POST['contact']) ||
        !isset($_POST['address']) ||
		 !isset($_POST['description'])) {
        died('We are sorry, but there appears to be a problem with the form you submitted.');      
    }
	    
	$name = $_POST['name']; // required
    $company = $_POST['copany']; // required
    $email_from = $_POST['email']; // required
    $contact = $_POST['contact']; // not required
    $comments = $_POST['description']; // required
     
    $error_message = "";
    $email_exp = "^[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$";
	
	
	// create email headers
$headers = 'From: '.$email_from."\r\n".
'Reply-To: '.$email_from."\r\n" .
'X-Mailer: PHP/' . phpversion();
@mail($email_to, $email_subject, $email_message, $headers); 
?>
last line is 43.......i mean "?>"
 
Old 01-20-2011, 12:40 AM   #2
Dark_Helmet
Senior Member
 
Registered: Jan 2003
Posts: 2,786

Rep: Reputation: 374Reputation: 374Reputation: 374Reputation: 374
I'm no expert in PHP, but didn't you forget a closing curly brace '}' for the open curly brace you used on line 2?
 
Old 01-20-2011, 01:19 AM   #3
vdx
Member
 
Registered: Aug 2007
Location: The Greate INDIA
Distribution: CentOS, RHEL, Fedora
Posts: 102

Rep: Reputation: 24
I dont know PHP a lot, but I think its because of some syntax error or missing required. The below post might help u.

http://www.linuxquestions.org/questi...d-$-in-433706/

http://www.linuxquestions.org/questi...-error-750017/
 
Old 01-20-2011, 02:28 AM   #4
shariefbe
Member
 
Registered: Aug 2008
Location: Tiruchirappalli, India
Distribution: UBUNTU 11.04
Posts: 368

Original Poster
Rep: Reputation: 31
Thank Dark helmet

I missed '}". Now it is not showing error.
But Now i have another problem. I am unable to send mail from localhost.
I think i have to configure SMTP server. But i dont know how to configure SMTP. i googled for that but its confusing to me.
Can anyone help me out. I want to send from my gmail account.
Thanks in advance...
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Parse error: parse error, unexpected '/' - can anyone see the error in this code? v@ny@ Programming 8 04-03-2010 04:07 PM
What's the meaning of "PHP Parse error: parse error, unexpected $ in..." frandalla Programming 23 03-04-2009 12:34 PM
PHP Error Parse error: parse error, unexpected $ in /home/content/S/k/i/SkinCare4U/h CowanServices Programming 2 12-09-2008 08:26 PM
PHP parse error in config.inc.php.in Confusedious Linux - Software 2 11-03-2005 05:08 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:18 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration