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 trent@studio9design.info 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 trent@studio9design.info 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
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 trent@studio9design.info or calling us at 715-688-9640"; 
}
?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.