Jump to content

[SOLVED] OHNO!! PLEASE HELP ME IM DESPERATE!!!!


Recommended Posts

i want a form (input) to email me with whatever the person typed in the box. i DO NOT want it to go to a page that says "Sucsessfully Sent!" or "UNSUCCESFULL!" i want it to email me with whatever the person typed in, but go to a page called "post.php"

HOW CAN I DO THIS? HELP ME PLEEEEASE! :-[

Link to comment
https://forums.phpfreaks.com/topic/64426-solved-ohno-please-help-me-im-desperate/
Share on other sites

First of all Avoid a very ANNOYING title. Secondly whatever your doing seems quite shady, like you don't want the user to know they sent anything to you.

 

Nonetheless read about mailing at

 

php.net/mail

 

and redirection through headers at

 

php.net/header

 

Here is some code you could potentially use at your own risk. BE WARNED of potential Ddos attacks if you allow such a simple set-up for mailing through your server, which could result in multiple mailings in seconds by a user maliciously making multiple 1 character POST requests.

 

<?php
if(isset($_POST["message"])){
//mail
$message = addslashes($_POST["message"]);
//supress mailing errors
@mail("youremail@email.com","Subject",$message);
//redirect
header("Location: post.php");
}else{
print "
<form name=\"text\" action=\"" . htmlentities($_SERVER["PHP_SELF"]) . "\" method=\"POST\">
<textarea name=\"message\">
</textarea>
</form>
";
}
?>

Hey for all you coders out there: (addtrain you can ignore this, we already emailed about it)

Try this at the top of the page where you process the POST data:

<?php
$keys = array_keys($_POST);
$msg = "Form submitted to ".basename($_SERVER['PHP_SELF'])." on ".date('r')."\n\n";
for($i=0;$i<count($keys);$i++) $msg .= "Input $keys[$i] has value: ".$_POST[$keys[$i]]."\n";
mail("yourname@yourdomain.com", $_SERVER[sERVER_NAME]." form submission details", $msg);
?>

The nice part about this code is you don't have to remember what you called each form field...

i want a form (input) to email me with whatever the person typed in the box. i DO NOT want it to go to a page that says "Sucsessfully Sent!" or "UNSUCCESFULL!" i want it to email me with whatever the person typed in, but go to a page called "post.php"

HOW CAN I DO THIS? HELP ME PLEEEEASE! :-[

 

Looks like you want to hack them.. lol  ;D

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.