PHP代码停止下面的代码

时间:2013-04-10 19:36:40

标签: php html

我有这个PHP代码:

<?php
$redirectURL = 'contests-representative-of-the-year-thankyou.php';
$email_to = 'alex@theadamgrp.com';
$subject = 'Submission Form';
#### DO NOT EDIT BELOW THIS LINE ####
require_once dirname(__FILE__) . '/securimage.php';
$securimage = new Securimage();
$captcha = (isset($_REQUEST['ct_captcha'])) ? $_REQUEST['ct_captcha'] :
'';

if ($securimage->check($captcha) == false)   {
    die ('<p style="margin:30px 0 0 0; font-weight:bold; font-size:16px;">Invalid security code entered. Please <a href="javascript:history.go(-1);">click here</a> to go back.</p>');
}

$message = 'This form submission was received at '.date('n/j/Y g:i A').': '."\n\n";
foreach ($_POST as $key=>$value){
    $message .= "\n\n".str_replace('_', ' ', $key).": \n".$value;
}

$message .= "\n\nIP: ".$_SERVER['REMOTE_ADDR'];
mail($email_to, $subject, $message, 'From: no-reply@email.com');
?>

当我将其插入我的网页时,它会删除&#34;我的其余代码如下。我想在它下面有一个带有链接和一切的页脚。这就是我在它下面的内容:

</div>
</div>
<?php include("subpage-bar.php"); ?>
</div>
</div>
</div>
<?php include("footer.php"); ?>
</body>

我上面的PHP代码是否有任何理由删除我在其下面编码的所有内容?如果您想直观地看到O的意思,可以使用link来查看来源。我无法弄清问题是什么。任何帮助表示赞赏。

1 个答案:

答案 0 :(得分:1)

die()更改为echo

所以改变

die ('<p style="margin:30px 0 0 0; font-weight:bold; font-size:16px;">Invalid security code entered. Please <a href="javascript:history.go(-1);">click here</a> to go back.</p>');

echo '<p style="margin:30px 0 0 0; font-weight:bold; font-size:16px;">Invalid security code entered. Please <a href="javascript:history.go(-1);">click here</a> to go back.</p>';

(所以没有parens ()的回声)

修改

对于工作的catha改变了这个:

if ($securimage->check($captcha) == false)   {
    die ('<p style="margin:30px 0 0 0; font-weight:bold; font-size:16px;">Invalid security code entered. Please <a href="javascript:history.go(-1);">click here</a> to go back.</p>');
}

$message = 'This form submission was received at '.date('n/j/Y g:i A').': '."\n\n";
foreach ($_POST as $key=>$value){
    $message .= "\n\n".str_replace('_', ' ', $key).": \n".$value;
}

$message .= "\n\nIP: ".$_SERVER['REMOTE_ADDR'];
mail($email_to, $subject, $message, 'From: no-reply@email.com');

进入这个:

if ($securimage->check($captcha) == false)   {
    echo '<p style="margin:30px 0 0 0; font-weight:bold; font-size:16px;">Invalid security code entered. Please <a href="javascript:history.go(-1);">click here</a> to go back.</p>';
} else {
    $message = 'This form submission was received at '.date('n/j/Y g:i A').': '."\n\n";
    foreach ($_POST as $key=>$value){
        $message .= "\n\n".str_replace('_', ' ', $key).": \n".$value;
    }

    $message .= "\n\nIP: ".$_SERVER['REMOTE_ADDR'];
    mail($email_to, $subject, $message, 'From: no-reply@email.com');
}