Page 1 of 1

Error on e-mail form handler

Posted: Fri Jun 17, 2005 8:41 pm
by bruceg
Hello,

I am getting an error on my email form handler. The error states:


Parse error: parse error, unexpected T_IF in /hsphere/local/home/bruceg/inspired-evolution.com/Thankyou.php on line 34

here is the code:

Code: Select all

<?php
$name=$_POST['name'];
$company=$_POST['company'];
$phone=$_POST['phone'];
$email=$_POST['email'];
$URL=$_POST['URL'];
$Contact_Preference=$_POST['Contact_Preference'];
$message=$_POST['Message'];

$formsent=mail('webguync@gmail.com',
'There has been a disturbance in the force',
"Request from:$name\r\n
Company name:$company\r\n
Phone Number:$phone\r\n
Email Address:$email\r\n
URL:$URL\r\n
Please Contact me via:$Contact_Preference\r\n
I wish to request the following additional information:$message"

if ($formsent {
  echo "<p> Hello, $name. We have received your request for additional information, and will try to respond within 24 hours. Thanks for visiting inspired-evolution.com!;

} else (
	echo "I'm sorry there seems to be a problem with your form. Please check to make sure all of the required fields have been filled out and try again.";</p>
)
?>
and the page for the form is:

http://www.inspired-evolution.com/contact.php

anyone see what's going on??

Posted: Fri Jun 17, 2005 8:49 pm
by Burrito
I see a few things you're missing:

1) the closing paren ")" on your mail function as well as your semicolon for that
** as a side note, you should keep your quote types consistent within functions (all single or all double)
2) missing a paren ")" on your if on line 20
3) missing a quote on line 21
4) your else block needs to have curly brackets not parens
5) your closing </p> needs to be inside your quotes.

Posted: Fri Jun 17, 2005 8:56 pm
by Chris Corbyn
Burrito wrote:I see a few things you're missing:

1) the closing paren ")" on your mail function as well as your semicolon for that
** as a side note, you should keep your quote types consistent within functions (all single or all double)
2) missing a paren ")" on your if on line 20
3) missing a quote on line 21
And what made it so obvious? :P Color coding / highlighting I'm guessing...

Hint: Get a nice editor... Even (almost all of) the freeware editors are better than a plain text editor ;) - If you're on windows I suggest Crimson and if you're on *nix I suggest the emacs php-elisp module or (if you want to pay) Zend Studio (also for windows). But we have a whole thread devoted to this so let's not start a discussion here :) let's also note that my opinions are just that... opinions ;)

EDIT | Burrito - Mayo is only good with chips / fries :P

Posted: Fri Jun 17, 2005 9:13 pm
by bruceg
thanks,

what about a cheap or free php editor for the mac??

Posted: Fri Jun 17, 2005 9:17 pm
by Chris Corbyn
viewtopic.php?t=6288

I'm sure that somewhere among the 15 pages it's been mentioned but I'm *almost* sure emacs is avilable on mac and perhaps Zend too since it's just Java based...