Sunday, May 19, 2024
 Popular · Latest · Hot · Upcoming
91
rated 0 times [  98] [ 7]  / answers: 1 / hits: 62620  / 15 Years ago, thu, october 22, 2009, 12:00:00

I don't code in PHP, but I have this form which I pulled off the web and its working great:



What I would like to do is somehow add some code in here that can fire up a JS script, simple alert box, saying Thank you form is submitted. After the form was received by this mailer.php file.



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

$to = [email protected];
$subject = Form Tutorial;
$name_field = $_POST['name'];
$email_field = $_POST['email'];
$message = $_POST['message'];

$body = From: $name_fieldn E-Mail: $email_fieldn Message:n $message;

echo Data has been submitted to $to!;
mail($to, $subject, $body);

} else {

echo blarg!;

}
?>

More From » php

 Answers
59

instead of:



echo Data has been submitted to $to!;


just



echo '<script type=text/javascript>alert(Data has been submitted to ' . $to . ');</script>';

[#98461] Monday, October 19, 2009, 15 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
americar

Total Points: 631
Total Questions: 107
Total Answers: 103

Location: Luxembourg
Member since Tue, Jan 25, 2022
2 Years ago
;