Syntax error with PHP code.

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
vsb909
Forum Newbie
Posts: 2
Joined: Mon Mar 31, 2014 11:04 pm

Syntax error with PHP code.

Post 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
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: Syntax error with PHP code.

Post 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
vsb909
Forum Newbie
Posts: 2
Joined: Mon Mar 31, 2014 11:04 pm

Re: Syntax error with PHP code.

Post by vsb909 »

Thanks Celauran, I will modify and try it.

And, many times, the Captcha is too hard to interpret and understand.
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: Syntax error with PHP code.

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