Email-redirect form
I need a form, when it's submitted the data needs to go to my email client and the page needs to be redirected.
function mailMe( form ) {
// put some checks here
return true;
}
</script>
<form action="mailto:fredje138@gmail.com" method="POST"
enctype="text/plain" name="email"
onsubmit="return mailMe( this.form )">
<p align="center">Name:<br>
<input type="text" size="30" name="filled by"><br>
kom je (ja/nee)<br>
<input type="text" size="30" name="komst "
value="ja"><br>
E-mail:<br>
<input type="text" size="30" name="EMAIL ADRESS"><br>
<input type="submit" value="Submit "></font></p>
</form>```
This one sends the data to my email but doesnt redirect and it asks to be sent or not, I want it to be sent without notice and afterwards redirected to another site. Is it possible?
If the submitting to email without notice isnt possible then submitting to a web page, that only I can view, is ok too. PHP can do the trick too, just dunno how :P
Help is appreciated.
thx!
<?php
if(isset($_POST["submit"]))
{
$frm = $_POST["name"]." <".$_POST["email"].">";
mail("fredje138@gmail.com", "The Subject", $_POST["msg"], "From: $frm");
echo "<meta http-equiv=\"refresh\"content="0; url=page_to_redirect_to.php\">
}
else
{
?>
<form method="POST" enctype="text/plain" name="email" action="<?=$_SERVER["PHP_SELF"]; ?>">
<p align="center">
Name:<br>
<input type="text" size="30" name="name"><br><br>
Email Address:<br>
<input type="text" name="email"><br><br>
Message:<br>
<input type="text" size="30" name="msg"><br>
<input type="submit" name="submit" value="Submit "></font></p>
</form>
<?php
}
?>
There's a script in PHP that will have them fill out the form with their Name, Email Address, and their Message. Then it will mail the information to you and redirect them page_to_redirect_to.php. Tweak it as necessary. If you need help changing something in this, let me know.
Also, make sure you save this with a "php" extension and upload it to a server that supports PHP.
if (isset($_POST['Subject']) OR isset($_POST['Body'])) {
$message = wordwrap($_POST['Body'], 70);
mail('fredje138@gmail.com', $_POST['Subject'] , $message);
echo "Message Sent";
} else {
echo "<form action=\"send.php\" method=\"post\">
Subject<input type=\"text\" name=\"Subject\"><br>
Message<input type=\"text\" name=\"Body\"><br>
<input type=\"Submit\" value=\"Send\">
</form>";
}
?>```
rushed, should do the trick.
Xero wrote:
<?php
if(isset($_POST["submit"]))
{
$frm = $_POST["name"]." <".$_POST["email"].">";
mail("fredje138@gmail.com", "The Subject", $_POST["msg"], "From: $frm");
echo "<meta http-equiv=\"refresh\"content="0; url=page_to_redirect_to.php\">
}
else
{
?>
<form method="POST" enctype="text/plain" name="email" action="<?=$_SERVER["PHP_SELF"]; ?>">
<p align="center">
Name:<br>
<input type="text" size="30" name="name"><br><br>
Email Address:<br>
<input type="text" name="email"><br><br>
Message:<br>
<input type="text" size="30" name="msg"><br>
<input type="submit" name="submit" value="Submit "></font></p>
</form>
<?php
}
?>
There's a script in PHP that will have them fill out the form with their Name, Email Address, and their Message. Then it will mail the information to you and redirect them page_to_redirect_to.php. Tweak it as necessary. If you need help changing something in this, let me know.
Also, make sure you save this with a "php" extension and upload it to a server that supports PHP.
this one gives this error: Parse error: parse error, unexpected ';' in C:\Program Files\wamp\www\test.php on line 15
willeH wrote:
if (isset($_POST['Subject']) OR isset($_POST['Body'])) {
$message = wordwrap($_POST['Body'], 70);
mail('fredje138@gmail.com', $_POST['Subject'] , $message);
echo "Message Sent";
} else {
echo "<form action=\"send.php\" method=\"post\">
Subject<input type=\"text\" name=\"Subject\"><br>
Message<input type=\"text\" name=\"Body\"><br>
<input type=\"Submit\" value=\"Send\">
</form>";
}
?>```
rushed, should do the trick.
no errors here but, I redirected it to the send.php page and that worked, but i didnt get an email :(