True format. echo
instead of echno
and fixed double quotes " "
if($send_contact){
echo "Thank You! <a href='index.html' style='text-decoration:none; color:#4fa9b8;'> Return Home </a>";
} else {
echo "ERROR";
}
質問
I'm new to coding and after hosting my site I got this error when checking to make sure my php contact form was working:
Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING on line 16
the php code is:
<?php
$subject="subject";
$message="$message";
$mail_from="$email";
$header="from: $name <$mail_form>";
$to='fearnstj@vcu.edu';
$send_contact=mail($to,$subject,$message,$header);
if($send_contact){
echno "Thank You!" "<a href='index.html' style='text-decoration:none; color:#4fa9b8;'> Return Home </a>";
}
else{
echno "ERROR";
}
?>
Any ideas on how I can fix this? Thank you in advance.
解決
True format. echo
instead of echno
and fixed double quotes " "
if($send_contact){
echo "Thank You! <a href='index.html' style='text-decoration:none; color:#4fa9b8;'> Return Home </a>";
} else {
echo "ERROR";
}
他のヒント
Your problem is with the following code
echno "Thank You!" "<a href='index.html' style='text-decoration:none; color:#4fa9b8;'> Return Home </a>";
^ ^ ^
echno "ERROR";
^
You either need to remove the two double quotes or concantinate the string with the .
operator.
echo "Thank You! <a href='index.html' style='text-decoration:none; color:#4fa9b8;'> Return Home </a>";
Also echno
is not a thing, the correct name is echo
.
change this:
if($send_contact){
echno "Thank You!" "<a href='index.html' style='text-decoration:none; color:#4fa9b8;'> Return Home </a>";
} else {
echno "ERROR";
}
to
if($send_contact){
echo "Thank You! "."<a href='index.html' style='text-decoration:none; color:#4fa9b8;'> Return Home </a>";
// ^ Here the point
} else {
echo "ERROR";
}
or (Updated)
if($send_contact){
echo "Thank You! <a href='index.html' style='text-decoration:none; color:#4fa9b8;'> Return Home </a>";
// ^ Eliminated double quotes
} else {
echo "ERROR";
}
Don't exist echno
and between the both string you forget the .
or to eliminate the " "