Solved

php syntax error

Posted on 2009-05-05
4
327 Views
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

<?php

	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

0
Comment
Question by:peter_coop
4 Comments
 
LVL 142

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 500 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'])) {
0
 
LVL 28

Expert Comment

by:gamebits
ID: 24305388
try

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

Expert Comment

by:sc_84
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);
            }
0
 

Author Closing Comment

by:peter_coop
ID: 31578045
thx once again
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to count occurrences of each item in an array.

867 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now