php syntax error

Posted on 2009-05-05
Medium Priority
Last Modified: 2012-05-06
hi. i am stumped as to why this script is giving a syntax error? the error is

Parse error: syntax error, unexpected '{' on line 183

The code below is the area around 183. it looks ok 2 me but obviously it is not. anyone see where i went wrong? cheers

	if (isset($_POST['prez']) && (isset($_POST['Intext'])) {
		include 'transsent.php';
		$to = "xxx@whatever.com";
		$subject = "Form Enquiry";
		$message = "You have an enquiry from $name for a whatever.\n\nEmail: $email";
		$headers = "From: $email";
		mail($to, $subject, $message, $headers);

Open in new window

Question by:peter_coop
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 143

Accepted Solution

Guy Hengel [angelIII / a3] earned 2000 total points
ID: 24305382
you have 1 ( too much:

      if (isset($_POST['prez']) && (isset($_POST['Intext'])) {
must be
      if (isset($_POST['prez']) && isset($_POST['Intext'])) {
LVL 28

Expert Comment

ID: 24305388

if (isset($_POST['prez']) && (isset($_POST['Intext']))) {

Expert Comment

ID: 24305419
You have one bracket open && (isset($_POST['lntext']

You either need to close this bracket or remove it:

if (isset($_POST['prez']) && isset($_POST['Intext'])) {
            include 'transsent.php';
            $to = "xxx@whatever.com";
            $subject = "Form Enquiry";
            $message = "You have an enquiry from $name for a whatever.\n\nEmail: $email";
            $headers = "From: $email";
            mail($to, $subject, $message, $headers);

Author Closing Comment

ID: 31578045
thx once again

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
This article discusses how to implement server side field validation and display customized error messages to the client.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Suggested Courses

718 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question