Reputation: 3941
Thanks to Col. Shrapnel I am using a VERY basic PHP script to send emails. The form is located here.
This is the script:
<?php
mail('[email protected]','Live Date Submission',implode("\n\n",$_POST));
header("Location: thankyou.html");
?>
When a user submits the form, they are redirected to a thankyou.html page. I want to edit the code to display a javascript alert, instead of a redirect. I don't have much PHP knowledge, so how would I edit this code to return a alert instead of a redirect?
Upvotes: 0
Views: 2389
Reputation: 28883
Actually, if you want to send a Javascript alert instead I would recommend using some basic jQuery work. I would also take a look at the AJAX section of the documentation.
Otherwise you can inset some javascript in the original form page.
session_start();
$_SESSION['message'] = "<script>alert('Thank you so very much! You rock!');</script>";
header("Location: originalformpage.html");
and on the original form page
session_start();
if(isset($_SESSION['message']))
{
echo($_SESSION['message']);
unset($_SESSION['message']);
}
Upvotes: 1
Reputation: 23244
Replace the header line with:
print("<script>alert('Thank you so very much! You rock!');</script>");
Not tested but should work.
Upvotes: 0