Error on e-mail form handler

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
bruceg
Forum Contributor
Posts: 174
Joined: Wed Mar 16, 2005 11:07 am
Location: Morrisville, NC
Contact:

Error on e-mail form handler

Post 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??
User avatar
Burrito
Spockulator
Posts: 4715
Joined: Wed Feb 04, 2004 8:15 pm
Location: Eden, Utah

Post 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.
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post 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
bruceg
Forum Contributor
Posts: 174
Joined: Wed Mar 16, 2005 11:07 am
Location: Morrisville, NC
Contact:

Post by bruceg »

thanks,

what about a cheap or free php editor for the mac??
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post 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...
Post Reply