DW CS5, Sending contact form results to email with page redirection using php script

I am currently building a site from scratch with Dreamweaver, with the intent of replacing my current website layout that was designed using Intuit's website builder. My dreamweaver site is not online, but i have setup a local test server on my computer, using XAMPP, and i have an apache server with a MySQL database and a mercury mailserver running. I mention that in case it makes a difference in your answers. If necessary, I can include those settings, but that may be asking too much.
I have an html contact form for users to schedule service appointments. I need the resulting actioned php file to do the following after submit is clicked: verify certain fields have been entered; prevent spammers or verify human visitors; send the form results to a (hidden from public view of any kind) email address; redirect user to a confirmation page, or an error page.
I found the following code but being less than a newbie im not sure what needs to be changed, or if its even the right script i should be using:
5 <?php
6 $email = $_POST['email'];
7 $mailto = '[email protected]';
8 $mailsubj = 'You Have a Service Request';
9 $url = '/MyLandingPage.html';
10 $req = '0';
11 $mailbody = "Results from form:\r\n";
12 $space = ' ';
13 $line = '
14 ';
15 foreach ($_POST as $key => $value)
16 {
17 if ($req == '1')
18 {
19 if ($value == '')
20 {echo "$key is empty";die;}
21 }
22 $j = strlen($key);
23 if ($j >= 20)
24 {echo "Name of form element $key cannot be longer than 20 characters";die;}
25 $j = 20 - $j;
26 for ($i = 1; $i <= $j; $i++)
27 {$space .= ' ';}
28 $value = str_replace('\r\n', "$line", $value);
29 $conc = "{$key}:$space{$value}$line";
30 $text .= $conc;
31 $space = ' ';
32 }
33 mail($emailadd, $subject, $text, 'From: '.$emailadd.'');
34 echo '<META HTTP-EQUIV=Refresh CONTENT="0; URL='.$url.'">';
35 ?>
Can anyone please illuminate me on what I need?
Thank You in advance

Take a read here, this might enlighten you a little.
http://www.paulgdesigns.com/learncontactform.php
You are doing this with your local testing server, is it set up to email?
Gary

Similar Messages

  • Has anyone tried to send a form in an email campaign?

    I am looking into sending a form for prospects to fill in an score themselves. When I send the form via the email campaign the fields fill but the information does not post.
    Is this possible?

    They don't work reliably in email. See this link for more info: http://www.campaignmonitor.com/resources/will-it-work/forms/

  • How do I make a submit button that sends the form to an email address?

    I can see how to link to an email which then opens up an email someone could attach the form to. But I do not see how to make a button that automatically sends the form to an email address. Can someone provide assistance? Thanks!

    I have the same question. You'd thing this would be a no brainer requirement for a form.

  • Using contact form created in DW with Business Catalyst (was: form submit)

    Hi.
    I hope some one can help. My son has built a contact form which he wants the contents to be sent to his email address when they submit it. His site is built using Dreamweaver and is hosted on BC, he has not used BC modules to build the site it was solely built in Dreamweaver CC and uploaded to BC. Can any one tell us what code we should be using for the form to be sent to his email as we are not sure what BC will accept.
    Thanks, James.

    jptphotography wrote:
    Hi Alex,I have found some php that hopefully will help it along, I will be trying it later.
    You need to find out if BC allows php processed forms to be hosted. Questions about form processing have come up before on the forum and I seem to remember that BC has its own way of processing forms, although I could  be wrong.
    If you need help with setting up a php script to process the form then there are plenty of people on the forum that could give you some guidance and assistance.

  • How do I send email with pictures attached, using PSE 9 and Windows 7 ?

    How do I send email with pictures attached, using PSE 9 and Windows 7 ?

    Try email attachment workflow in Organizer. http://tv.adobe.com/watch/learn-photoshop-elements-9/sharing-your-images-via-email/
    Thanks
    Andaleeb

  • Send email with multiple attachments using MS outlook

    Hi,
    Is it possible to send an email with multiple attachments using MS outlook. (Using activex)
    Regards,
    Neha

    nehrnul wrote:
    Hey thanks for the reply. I'll try that way also.
    but currently my requirement is to send email using MS Outlook. And I found 1 solution using invoke node
    Regards,
    Neha
    That' "requirement" sounds like it was written by someone who is trying to drive the design of the application.  Without knowing your personal situation it's hard for me to say, but if I had to guess I would say the real requirement is to send an email with multiple attachements, and the person giving that requirement thought sending it through Outlook would be the best way.  You should get clairification on what the real intend of that requirement is.
    Unofficial Forum Rules and Guidelines - Hooovahh - LabVIEW Overlord
    If 10 out of 10 experts in any field say something is bad, you should probably take their opinion seriously.

  • How can i send a document through my email with a ipod touch 2nd generation?

    How can i send a document through my email with a ipod touch 2nd generation?

    https://itunes.apple.com/us/app/id314894105?mt=8
    https://itunes.apple.com/us/app/id306273816?mt=8
    They have some limitations though. They have paid versions that remove those limitations

  • Posting contact form to variable email address PHP

    Hi all, another one!
    I want the email address to be the hidden variable in the form below - variable higlighted in Red. What would I put for "$to ="?
    Any help would be appreciated.
    Tom
    <?php
    if (array_key_exists('send' , $_POST)) {
              // mail processing script
              // remove escape characters from POST array
    if (PHP_VERSION < 6 && get_magic_quotes_gpc()) {
      function stripslashes_deep($value) {
        $value = is_array($value) ? array_map('stripslashes_deep', $value) : stripslashes($value);
        return $value;
      $_POST = array_map('stripslashes_deep', $_POST);
    $to = '';
              $subject = '';
              //list expected fields
              $expected = array('name', 'email', 'comments');
              //set required fields
              $required = array('name', 'comments');
              //create empty array for any missing fields
              $missing = array();
              // assume that there is nothing suspect
              $suspect = false;
              // create a pattern to locate suspect phrases
              $pattern = '/Content-Type:|Bcc:|Cc:/i';
                // function to check for suspect phrases
      function isSuspect($val, $pattern, &$suspect) {
        // if the variable is an array, loop through each element
              // and pass it recursively back to the same function
              if (is_array($val)) {
          foreach ($val as $item) {
                  isSuspect($item, $pattern, $suspect);
                } else {
          // if one of the suspect phrases is found, set Boolean to true
                if (preg_match($pattern, $val)) {
            $suspect = true;
              // check  the $_POST array and any subarrays for suspect content
              isSuspect($_POST, $pattern, $suspect);
              if ($suspect) {
                        $mailSent = false;
                        unset($missing);
              } else {
              //proces the $_POST Variables
              foreach ($_POST as $key => $value) {
                        //assign temporary variable and strip whitespace if not an array
                        $temp = is_array($value) ? $value: trim($value);
                        //if empty and required, add to $missing array
                        if (empty($temp) && in_array($key, $required)) {
                                  array_push($missing, $key);
                        } elseif (in_array($key, $expected)) {
                                  //otherwise, assign to a variable of the same name as $key
                                  ${$key} = $temp;
              // validate the email address
      if (!empty($email)) {
        // regex to identify illegal characters in email address
        $checkEmail = '/^[^@]+@[^\s\r\n\'";,@%]+$/';
              // reject the email address if it doesn't match
        if (!preg_match($checkEmail, $email)) {
          $suspect = true;
          $mailSent = false;
          unset($missing);
              //go ahead ONLY if not suspect and all required fields OK
              if (!$suspect && empty($missing)) {
              // build the message
              $message = "Name: $name\r\n\r\n";
              $message .= "Email: $email\r\n\r\n";
              $message .= "Message: $comments\r\n\r\n";
              //limit line length to 70 characters
              $message = wordwrap($message, 70);
              //Create aditional headers
              $headers = "From: Website Enquiry\r\n";
              $headers .= 'Content-Type: text/plain; charset=utf-8';
              if (!empty($email)) {
              $headers .= "\r\nReply-To: $email";
              //send it
              $mailSent = mail($to, $subject, $message, $headers);
              if ($mailSent) {
                        //$missing is no longer needed if the email is sent, so unset it
                        unset($missing);
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <?php
    if ($_POST && $mailSent) { ?>
    <META HTTP-EQUIV="Refresh" CONTENT="5;URL=index.php">
    <?php } ?>
    <title></title>
    <meta name="description" content="" />
    <meta name="keywords" content="" />
    <link href="style/style.css" rel="stylesheet" type="text/css" />
    <script src="SpryAssets/SpryValidationTextField.js" type="text/javascript"></script>
    <link href="SpryAssets/SpryValidationTextField.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript">
      var _gaq = _gaq || [];
      _gaq.push(['_setAccount', 'UA-11804201-5']);
      _gaq.push(['_trackPageview']);
      (function() {
        var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
        ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
        var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
    </script>
    </head>
    <body<?php if ($_POST && $mailSent){ ?> onLoad="redirect()"<?php } ?>>
    <img src="images/photography/background.jpg" alt="Jack Wilesmith Furniture Design" class="bg" id="bg" />
    <div id="container">
      <div id="Header">
      </div>
      <div id="content">
    <?php
    if ($_POST && isset($missing) && !empty($missing)) {
              ?>
        <p class="warning"><strong>Please complete the missing item(s) indicated.</strong></p><br />
        <?php
    } elseif ($_POST && !$mailSent) {
              ?>
        <p class="warning"><strong>Sorry, there was a problem sending your message, please try again later. </strong></p><br />
              <?php
    } elseif ($_POST && $mailSent) {
              ?>
        <p><strong>Your Message has been sent succesfully - <strong>You will be redirected in 5 seconds</strong></strong></p><br />
    <SCRIPT LANGUAGE="JavaScript"><!--
    function redirect () { setTimeout("go_now()",5000); }
    function go_now ()   { window.location.href = "index.php"; }
    //--></SCRIPT>
        <?php } ?>
        <form id="form1" name="form1" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
        <p>
          <label for="name">Name:</label><br />
          <input name="name" type="text" class="textInput" id="name"
          <?php if (isset($missing)) {
    echo 'value="' . htmlentities($_POST['name'], ENT_COMPAT, 'UTF-8') . '"';
    ?>
          /> <?php
                if (isset($missing) && in_array('name', $missing)) {?> <span class="warning">Please enter your name</span><?php } ?>
        </p><br />
        <p>
          <label for="email">Email:</label><br />
          <span id="sprytextfield1">
          <input name="email" type="text" class="textInput" id="email"
          <?php if (isset($missing)) {
    echo 'value="' . htmlentities($_POST['email'], ENT_COMPAT, 'UTF-8') . '"';
    ?>
          />
    <span class="textfieldInvalidFormatMsg">Invalid format.</span></span>
          <?php
                if (isset($missing) && in_array('email', $missing)) {?> <span class="warning">Please enter your Email Address</span><?php } ?>
        </p><br />
        <legend></legend>
        <p>
          <label for="comments">Message:</label><br />
          <textarea name="comments" id="comments" cols="45" rows="5"><?php if (isset($missing)) {
                        echo htmlentities($_POST['comments'], ENT_COMPAT, 'UTF-8');
                } ?></textarea><?php
                if (isset($missing) && in_array('comments', $missing)) {?> <span class="warning">Please enter a Message</span><?php } ?>
        </p><br />
        <p class="clearIt">
          <input name="send" type="submit" id="send" value="Send message" />
        </p>
         <input name="email" type="hidden" id="email" value="[email protected]" />
    </form>
    </div>
    </div>
    <script type="text/javascript">
    <!--
    var sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1", "email", {isRequired:false, hint:"[email protected]"});
    //-->
    </script>
    </body>
    </html>

    Lovely, simple but beautiful!
    Thanks for that.
    T

  • Contact Form Issues When Email Received.

    Using the standard detailed contact form widget by Adobe, I added a few extra input boxes, I then moved them around so that the 'message' box was at the bottom. When testing the contact form the input from the 'message' box was in the middle with the extra info below it. Obviously this will be unacceptable for clients to get this. so is there a way to fix this?
    An example if I have not explained it properly.
    What my website says:
    Name:
    Phone Number:
    Email:
    Website:
    Budget:
    Message:
    What the email i receive says:
    Name
    Phone Number:
    Email:
    Message:
    Website:
    Budget:
    Thanks in advance for any support!

    Notification would include the box fields in list as they were created , means website and budget field are created after message field so they would be down on the menu.
    Example : Fields created in Form
    Field 1
    Field 2
    Field 3
    - Rearranged the fields :
    Field 3
    Field 1
    Field 2
    Form notification will follow the default hierarchy :
    Field 1
    Field 2
    Field 3
    You would need to delete message field , create website and budget field and then create message filed if you want message filed to be included as last data field in notification email.
    Thanks,
    Sanjit

  • Captivate 3 send Quiz and Results via email

    I created a Quiz in Captivate 3. Upon completion of the quiz I would like to have all the questions which were answered and the results emailed to me in PDF (or word if possible). In Captivate 3 I can receive an email with the pass/fail completion scores etc. This is not enough information. I need to know which questionss were answered in order to get back to the person who took the quiz and give them further assistance. We have Adobe Connect Pro, but did not purchase the LMS. Can this be done without an LMS? Can this be done in Captivate 4?

    Short answer: no
    Longer: Search and read through these forums for all the issues surrounding email. Not only is it not terribly reliable but it's also not terribly customizable.
    You could possibly do what you need if you've got some Javascript folks there who can parse through the Captivate HTML/JS files and modify them to output interaction data to the email... To do that, I suspect you'd have to setup the lesson to work with SCORM, but then modify the resulting published HTML/JS files to redirect all SCORM API calls to some other functionality that would instead insert the desired information into an email.
    It may be better to just get an LMS. ;-)
    I think I've seen an article somewhere on Adobe's site, likely by Andrew Chemey, that discussed modifying the published files to send data to a standard database instead of an LMS...so maybe that would be an option, or that could be a base article for modifying the code to work with email. Worth a search of Adobe's site, I suspect.
    HTH!
    Erik

  • Contact form doesn't work with some email addresses

    My contact form was working fine until a few weeks ago, now it won't work with the e-mail address I was using. I have tried different address some work some don't , what gives here.
    For what I'm paying I should not be having this problem.

    Please find a similar discussion here and try the suggestion mentioned :
    http://forums.adobe.com/message/6304524#6304524
    Thanks,
    Sanjit

  • Why cant I send an email with my iphone4 using bellsouth?

    Anyone know why I cant send an email anymore with the iphone4 using the bellsouth email?

    I have a bellsouth, yahoo, gmail, and work account.  Last time I went into the apple store they updated it with the cwmx.com that they were using and few months that dropped.  Then I searched around and found the AT&T SMTP server that was working fine and now its down.  Is there a way to convert the bellsouth account without having to send all my contacts the famous email "I have changed email accounts"?

  • Sending an email with text Content using SMTP Adapter.

    I am trying to send an email Message with the .txt attachment using SMTP adapter. I am getting an XML input and I am mapping the input Schema to Flat File Schema. I am trying to Send this Flat File(.txt attachment) in the Email. But I am receiving it as 
    HTML format only.
    The Expression in the Message Transform is,
         SMTPUtils.Part.SetContentType(OutgoingFlatFile_Msg.BodyFlatFile,"text");
         OutgoingFlatFile_Msg(SMTP.EmailBodyTextCharset)="UTF-8";
         DynamicEmailPort(Microsoft.XLANGs.BaseTypes.Address) = "mailto:[email protected]";
         OutgoingFlatFile_Msg(SMTP.CC) = "[email protected]";
         OutgoingFlatFile_Msg(SMTP.Subject) = "TESTMAIL";
         OutgoingFlatFile_Msg(SMTP.From) = "[email protected]";
         OutgoingFlatFile_Msg(SMTP.SMTPHost) = "smtp.org";
         OutgoingFlatFile_Msg(SMTP.SMTPAuthenticate) = 0;
    The Email attachment is HTML format,
    <?xml version="1.0" encoding="utf-8"?><ns0:Root xmlns:ns0="http://SampleSMTPEmail.OutgoingFlatFile"><Record><CustomerID>Cus001</CustomerID><OrderID>Ord001</OrderID></Record></ns0:Root>
    How to attach the .txt file to the email.

    Have you tried the following steps:
    Create the message (“msgEnvelope”) as a Multi-Part message, with the required message in the Message Body Part (“Attachment”)
    Set the following properties of the Envelope Message:
    msgEnvelope(SMTP.Subject) = <Email Subject>;
    msgEnvelope(SMTP.From) = <Sender Email>;
    msgEnvelope(SMTP.SMTPHost) = <Email Host name>";
    // This is the default value
    msgEnvelope(SMTP.SMTPAuthenticate) = 0;
    // Set the message text included in the email
    msgEnvelope(SMTP.EmailBodyText) = <Text in body of email>;
    // Important - This is required if the EmailBodyText is set
    msgEnvelope(SMTP.EmailBodyTextCharset) = "utf-8";
    // A value of '1' means include Message Body Part as email attachment
    msgEnvelope(SMTP.MessagePartsAttachments) = 1;
    Set the following properties of the Message Body Part (“Attachment”):
    // Important - Change this MIME type if not sending a Text file
    msgEnvelope.Attachment(Microsoft.XLANGs.BaseTypes.ContentType) = "text/plain";
    // Set the Filename of the attachment
    msgEnvelope.Attachment(MIME.FileName) = <Physical name of the attachment>;
    Set the following property on the Dynamic Send Port:
    // We set the Email Address on the Port itself
    Dynamic_Send_Port(Microsoft.XLANGs.BaseTypes.Address) = <recipient email address>;
    http://biztalktalk.wordpress.com/2008/08/28/sending-attachments-through-a-dynamic-send-port/
    If this answers your question please mark it accordingly. If this post is helpful, please vote as helpful by clicking the upward arrow mark next to my reply.

  • How can I attach a form to an email with TO address default in?

    I have a form with a hyperlink to an email address.  I want to have it when the user clicks the hyperlink the form attaches to an email with the address filled out.  I have figured out how to open an email with the email filled out; and how to open an email with the form attached - but not both.  I am not very familiar with JavaScript - but I have to believe there is a way to "Execute a menu item -- File>Attach to email..." AND "open a web link -- Mailto:[email protected]".

    You can use either the doc.mailDoc (best) or doc.submitForm JavaScript methods. For more information, see:
    mailDoc: http://livedocs.adobe.com/acrobat_sdk/9.1/Acrobat9_1_HTMLHelp/JS_API_AcroJS.88.505.html
    submitForm: http://livedocs.adobe.com/acrobat_sdk/9.1/Acrobat9_1_HTMLHelp/JS_API_AcroJS.88.537.html

  • "Sending Failure". Can't send, forward or reply to email with attachments or pictures

    I have a Galaxy S5. When I try to send, forward or reply to an email with an attachment or picture it gets stuck in my outbox with a final message on my notification page of "sending failure". I have removed and re added my email accounts as well as cleared the cache without any luck.  Any suggestions?
    Thanks in advance!

        kpgrl,
    Let's get your emails back in business! Have you tried installing a third party app to use for your email? Have you removed the email and readded it? Please share details.
    KarenC_VZW
    Follow us on Twitter @VZWSupport

Maybe you are looking for

  • Home Sharing between 2 Apple ID accounts on separate PCs...can our iOS devices access both?

    Hi All Hope someone can help.  My wife and I have separate iTunes accounts with separate Apple IDs on separate PCs. We both have HomeSharing turned on and can access each others music libraries from both PCs which is great.  However when I try to acc

  • Bseg-XREF1 missing in F-03

    Hi The  Reference Key 1,2 and 3 is missing in fb03. The document i posted is a downpayment request to a vendor, The document posted while viewing in FB03, the additional data tab is not showing the Reference Key filelds1, 2 and 3. Do somebody knows h

  • Getting realistic performance expectations.

    I am running tests to see if I can use the Oracle Berkeley XML database as a backend to a web application but am running into query response performance limitations. As per the suggestions for performance related questions, I have pulled together ans

  • False links in emails

    I made the stupid mistake of clicking on a link in a phishing email. Is there any way I can check that I haven't got some malware on my Mac? I can't see anything in downloads, so hopefully I haven't. Thanks in advance.

  • Battery is not charging after buying new charger for Qosmio X300

    Hello all My problem started when the charger of my laptop toshiba qosmio x300-130 made a strange noise and stoped working . laptop stayed on and was working perfectly as the battery was full . I cloused pc and opened again next day to check my mails