Jump to content

PHP HTML Mixture problems.


schug.trent

Recommended Posts

I have a contact form in HTML that uses a file, send.php, to send the entered info to my email.

 

when the "successfully sent" message comes up I want it to be able to put HTML in that spot. the code for that part looks like this in the php file.

 



$sent = mail($to, $subject, $message, $headers) ;
if($sent)
{print "\n\n<br>Your quote request was sent successfully. You will be contacted within two business days. <br><br>http://www.studio9design.info";  }
else
{print "We encountered an error sending your mail, please try sending an email to [email protected] or calling us at 715-688-9640"; }



?>

 

 

Where it says "{print "\n\n<br>Your quote request was sent successfully. You will be contacted within two business days. <br><br>http://www.studio9design.info";  }" I would rather put some html in there.

 

I have tried this



$sent = mail($to, $subject, $message, $headers) ;
if($sent) ?>
<html><body><table><tr><td>blah blah blah code code code</td></tr></table></body></html>
<?
else
{print "We encountered an error sending your mail, please try sending an email to [email protected] or calling us at 715-688-9640"; }



?>

 

But it doesn't work. I get a syntax error regarding the '"else" before the last {print...........}

 

any suggestions?

 

Link to comment
https://forums.phpfreaks.com/topic/133832-php-html-mixture-problems/
Share on other sites

You'll need to use braces:

 

$sent = mail($to, $subject, $message, $headers) ;
if($sent){ 
?>
<html><body><table><tr><td>blah blah blah code code code</td></tr></table></body></html>
<?
}else{
print "We encountered an error sending your mail, please try sending an email to [email protected] or calling us at 715-688-9640"; 
}
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.