Page 1 of 1

Syntax error with PHP code.

Posted: Mon Mar 31, 2014 11:08 pm
by vsb909
I just started learning PHP - A beginner.

I installed WampServer and writing PHP forms.

I got error, and tried different ways, but could not resolve this. Can any one please suggest.

Code: Select all

$formcontent=" From: $name \n Phone: $phone \n Call Back: $call \n Website: $website \n Priority: $priority \n Type: $type \n Message: $message";
	$recipient = "youremail@here.com<script type="text/javascrip" >
	
"Error - Missing ;"

Also attached the PHP file.

Best regards

Re: Syntax error with PHP code.

Posted: Tue Apr 01, 2014 7:18 am
by Celauran
There's definitely a semicolon missing from the end of that second line, but there's also a problem with your quotes. If you want to include double quotes inside a double-quoted string, you need to escape them.

Code: Select all

$string = "String "with" quotes"; // won't work
$string = "String \"with\" quotes"; // Correct

Re: Syntax error with PHP code.

Posted: Tue Apr 01, 2014 10:54 pm
by vsb909
Thanks Celauran, I will modify and try it.

And, many times, the Captcha is too hard to interpret and understand.

Re: Syntax error with PHP code.

Posted: Wed Apr 02, 2014 8:19 am
by Celauran
CAPTCHAs have become a bit of a usability nightmare IMO and I'll sometimes forego them in favour of honeypots. Nothing's foolproof, though.