2012-07-16 51 views
0

我是新来的php &有一个简单的“告诉朋友”的代码。弹出窗口假设是&表示该消息已发送给该朋友。这在Safari中很有效,但是它在IE浏览器中显示为空白。PHP显示空白信息IE和Firefox,但不是Safari

下面是代码:

<?php 
if(isset($_POST['email'])) { 

$email_to = "[email protected]"; 
$email_subject = "Check this site out!"; 

function died($error) { 
    //error code 
    echo "We are very sorry, but there were error(s) found with the form you submitted. "; 
    echo "These errors appear below.<br /><br />"; 
    echo $error."<br /><br />"; 
    echo "Please go back and fix these errors.<br /><br />"; 
    die(); 
    } 

    // validation expected data exists 
    if(!isset($_POST['senders_email']) || 
    !isset($_POST['email'])) { 
    died('We are sorry, but there appears to be a problem with the form you submitted.');  
    } 

$email_from = $_POST['senders_email']; // required 
$email = $_POST['email']; // not required 

$error_message = ""; 
$email_exp = '/^[A-Za-z0-9._%-][email protected][A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/'; 
if(!preg_match($email_exp,$email_from)) { 
$error_message .= 'The Email Address you entered does not appear to be valid.<br />'; 
} 

if(strlen($error_message) > 0) { 
died($error_message); 
} 

function clean_string($string) { 
    $bad = array("content-type","bcc:","to:","cc:","href"); 
    return str_replace($bad,"",$string); 
} 
$email_message .= "I was on this site today & thought you would be interested."; 
$email_message .= "\nwww.primaresidential.com\n\n"; 
$email_message .= "Dear " .clean_string($email). ",";  
$email_message .= "\nYour friend, " .clean_string($email_from). " had linked"; 
$email_message .= "our site to your email, we hope you enjoy our site as much as they did!"; 
$email_message .= "\n\nPrima Residential Services."; 

//email headers 
$headers = 'From: '.$email_from."\r\n". 
'Reply-To: '.$email_from."\r\n" . 
'X-Mailer: PHP/' . phpversion();  
@mail($email_to, $email_subject, $email_message, $headers); 
@mail($email, $email_subject, $email_message, $headers); 
?> 

    <!----HTML CODE------> 

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
    <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> 
    <head> 
    <title>PrimaResidential Serivces- Emailer</title> 
     <style type="text/css" media="all">@import "css/style.css";</style> 
     <style type="text/css" media="all">@import "css/style.css";</style> 


     </head> 
    <br/><br/><br/><br/><br/> 
     <div class="boxbg all-round" id="page-container-Popup"> 
     <br/><br/><br/><br/><br/><center> 
     <h2>Your email was successfully sent.</h2><br> 
     <br><h3>Thank you for spreading the word.<br> 
      <font size="1"> Be sure to check your email in the next 2-3 business days for a little surprise.</font></h3> 
     <br/></center> 

     </div> 
     <a href="javascript:window.close()">Close Window</a>  


    </body> 
    </html> 

    <?php 
     } 
    ?> 

请让我知道,如果你看到我做错了什么或什么,我需要补充。谢谢:)

回答

2

您没有包含<body>标记,因此浏览器被迫猜测。您还将两次导入相同的样式表。有可能过量的<br>标记会将实际内容从屏幕底部推出,或者如果屏幕底部有overflow:hidden,则可能不在屏幕上。总的来说,你有很多问题,我建议你解决,看看是否有帮助。

+0

我很感激。我会尝试修复这些问题,看看它是否有效! – ashleigh 2012-07-20 23:55:04

+0

这是标签,天哪!在这里我想这是我的noob PHP自我和它真的错过了HTML! *打额头*谢谢! – ashleigh 2012-07-21 00:55:32

相关问题