David4321 Posted January 24, 2008 Share Posted January 24, 2008 Hello, and thanks in advence for any assistance - I have a website on godaddy, and I've been using their gdform.php script for form mailing. It is in 2 parts - the gdform.php which is in my folder, and the mailer which I cannot view or edit, on their server. As it exists, the email subject is determined in my html, and the mailto address was entered in godaddy control panel. My objective: A) To create a php form mailer script which will replace the gdform entirely. B) I want new script to grab the contents of 1 form field (customer name) and add it to the emial subject line. ie: I want the email subject to read "Order from: 'customer name'" //from "Editbox14" I am a complete novice in php. I have moderate knowledge with HTML. I am quick and creative, but I lack background - so please don't make assumptions on what I know. Since this is a short script, the most helpful would be fully formed script suggestions for me to play with. (doctor mine below) ----------------------------------------------------------------- Here is the html line which posts the form and defines the email subject line: <form name="Form1" method="post" action="http://www.mywebsite.com/test/mmcform.php" enctype="multipart/form-data" id="Form1" onsubmit="return ValidateForm1(this)" ><input type="hidden" name="redirect" value="purchase.html"><input type="hidden" name="subject" value="Order From:"> ----------------------------------------------------------------- Here is the existing gdform.php: <?php $request_method = $_SERVER["REQUEST_METHOD"]; if($request_method == "GET"){ $query_vars = $_GET; } elseif ($request_method == "POST"){ $query_vars = $_POST; } reset($query_vars); $t = date("U"); $file = $_SERVER['DOCUMENT_ROOT'] . "/../data/gdform_" . $t; $fp = fopen($file,"w"); while (list ($key, $val) = each ($query_vars)) { fputs($fp,"<GDFORM_VARIABLE NAME=$key START>\n"); fputs($fp,"$val\n"); fputs($fp,"<GDFORM_VARIABLE NAME=$key END>\n"); if ($key == "redirect") { $landing_page = $val;} } fclose($fp); if ($landing_page != ""){ header("Location: http://".$_SERVER["HTTP_HOST"]."/$landing_page"); } else { header("Location: http://".$_SERVER["HTTP_HOST"]."/"); } ?> -------------------------------------------------------------------- Here is a variant I've been modifying and testing (with no success so far) (I changed the script name to mmcform.php, and replaced all references to gdform with mmcform in both php and html.) <?php $request_method = $_SERVER["REQUEST_METHOD"]; if($request_method == "GET"){ $query_vars = $_GET; } elseif ($request_method == "POST"){ $query_vars = $_POST; } reset($query_vars); $t = date("U"); $to ="myemail@email"; $from = $_POST['Editbox14']; $subject ="Order from:" . $_POST['Editbox14']; mail($to ,$from , $subject, $message) $message .= '$_POST['Editbox1'] $message .= '$_POST['Editbox2'] $message .= '$_POST['Editbox14'] $file = $_SERVER['DOCUMENT_ROOT'] . "/../data/gdform_" . $t; $fp = fopen($file,"w"); while (list ($key, $val) = each ($query_vars)) { fputs($fp,"<MMCFORM_VARIABLE NAME=$key START>\n"); fputs($fp,"$val\n"); fputs($fp,"<MMCFORM_VARIABLE NAME=$key END>\n"); if ($key == "redirect") { $landing_page = $val;} } fclose($fp); if ($landing_page != ""){ header("Location: http://".$_SERVER["HTTP_HOST"]."/$landing_page"); } else { header("Location: http://".$_SERVER["HTTP_HOST"]."/"); } mail($to,$from, $subject, $message) if(!mail){ echo 'Message Not sent!'; } echo 'Message was sent!'; ?> Thanks so much again for any assistance Quote Link to comment https://forums.phpfreaks.com/topic/87668-replace-go-daddy-gdformphp-with-custom-php-form-mailer/ Share on other sites More sharing options...
David4321 Posted January 25, 2008 Author Share Posted January 25, 2008 Hi All, Please don't be intimidated - I know I left a lot of information below. I hoped it would make it easier. I think this should be really simple for the right person. A) I just need a basic form mailer script. B) I'd like it if it could grab a bit of data from the form and add it to the subject line. Thanks again for any assistance. Quote Link to comment https://forums.phpfreaks.com/topic/87668-replace-go-daddy-gdformphp-with-custom-php-form-mailer/#findComment-448528 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.