问题描述:

Well... I tried this:

if ($resp->is_valid) {

@mail($email_to, $email_subject, $email_message, $headers);

print "<script language="javascript">

window.alert("'Thank you for submitting the track. We will be in touch with you very soon. Click 'Ok' to redirect you to the Homepage.'")

window.location.href='http://www.xmasterofficial.tk/'

</script>";

} else {

echo "Sorry cannot send email as you've failed to provide correct captcha! Try again...";

}

I don't know what is the problem. It should create a window.alert if $resp is valid or post a message if not. The window.alert is not showing up.

网友答案:

The code have some issue in using quotes inside your print statement.Use echo instead of print while treating with more than one string .and you need to treat quotes separately to work this and this must help you to work your alert option.

if ($resp->is_valid) {
@mail($email_to, $email_subject, $email_message, $headers);
echo "<script language='javascript'>
window.alert('Thank you for submitting the track. We will be in touch with you very soon. Click Ok to redirect you to the Homepage.')
window.location.href='http://www.xmasterofficial.tk/'
</script>";
} else {
echo "Sorry cannot send email as you have failed to provide correct captcha! Try again...";
}
网友答案:
if ($resp->is_valid) {
@mail($email_to, $email_subject, $email_message, $headers);
echo "<script type='text/javascript'>
alert('Thank you for submitting the track. We will be in touch with you very soon. Click Ok to redirect you to the Homepage.');
window.location.href='http://www.xmasterofficial.tk/';
</script>";
} else {
echo "Sorry cannot send email as you have failed to provide correct captcha! Try again...";
}
相关阅读:
Top