If statement doesn't work? do download without filed name and email
Posted
by
user1833871
on Stack Overflow
See other posts from Stack Overflow
or by user1833871
Published on 2012-11-18T16:55:11Z
Indexed on
2012/11/18
16:59 UTC
Read the original article
Hit count: 235
php
I've created some if / else statements to get a download when a user hit click jf he fields name and email but doesn"t work for my site http://my-easy-woodworking-projects.com because it is do download without field name and email contact.php is
<?php
$field_name = $_POST['cf_name'];
$field_email = $_POST['cf_email'];
$field_message = $_POST['cf_message'];
$mail_to = '[email protected]';
$subject = 'Message from a site visitor '.$field_name;
$body_message = 'From: '.$field_name."\n";
$body_message .= 'E-mail: '.$field_email."\n";
$body_message .= 'Message: '.$field_message;
$headers = 'From: '.$field_email."\r\n";
$headers .= 'Reply-To: '.$field_email."\r\n";
$mail_status = mail($mail_to, $subject, $body_message, $headers);
if ($mail_status) {
echo <script>\n"
echo "var str = \"download\"; \n""
echo "document.write(str.link("http://www.myshedplans.com/12BY8SHED.pdf"));\n"
echo "</script>\n"
}
echo
else {
echo <script language="javascript" type="text/javascript">
echo // Print a message
echo alert('Message failed. Please, send an email to [email protected]');
echo // Redirect to some page of the site. You can also specify full URL, e.g. http://template-help.com
window.location = 'contact_page.html';
echo </script>
}?>
© Stack Overflow or respective owner