How Do I Tell The Send Button On A Contact Us Form To Take Info To An Email Account?


 

as in question have built 'contact us' form, although not sure put php. script details in form forwarded email account.

 

currently ehen press send message button in preview mode page refreshes , discards information.

 

if not php. script, possible put "<a href="[mailto:example@email.com.au | mailto:example@email.com.au]">" somewhere in code below?

 

<div id="contact_form">
  <form id="contactform" method="post" action="">
    <table width="670" border="1">
      <tr>
        <td><label for="firstname"></label>
          <span id="sprytextfield1">
          first name:<br />
          <input type="text" name="firstname" id="firstname" />
          <span class="textfieldrequiredmsg">a value required.</span></span></td>
      </tr>
      <tr>
        <td><p>email address:</p></td>
      </tr>
      <tr>
        <td><label for="lastname"></label>
          <span id="sprytextfield2">
          <input type="text" name="lastname" id="lastname" />
          <span class="textfieldrequiredmsg">a value required.</span><span class="textfieldinvalidformatmsg">invalid format.</span></span></td>
      </tr>
      <tr>
        <td><p>message:</p></td>
      </tr>
      <tr>
        <td><label for="message"></label>
          <span id="sprytextarea1">
          <textarea name="message" id="message" cols="45" rows="5"></textarea>
          <span class="textarearequiredmsg">a value required.</span></span></td>
      </tr>
      <tr>
      </tr>
      <tr>
        <td><input type="submit" name="submit" id="submit" value="send message" /></td>  (i thinking line that needs altering)
      </tr>
      <tr>
     
      </tr>
    </table>
  </form>
</div>

 

any tips extremely useful!! thanks

save below code contact_form.php , change email address want information sent. make thankyou.php page (this page user gets taken after submitting message) can confirm user email has been sent. have not put validation on forms input fields because see using spry validation that.

 

 

 

<?php

if (array_key_exists('submit', $_post)) {

$firstname = $_post['firstname'];

$emailaddress = $_post['emailaddress'];

$message = $_post['message'];

 

// recipient/subject/sender

$to = "emailaddress@yourdomainname.com";

$subject = "email message";

$sender = "from:".$_post['emailaddress']."\r\n";

// message

$message = "please contact me regarding following enquiry.\n\n";

$message .= "name: $firstname\n\n";

$message .= "email address: $emailaddress\n\n";

$message .= "message: $message\n\n";

 

 

mail($to, $subject, $message, $sender);

header("location: thankyou.php");

}

 

?>

 

 

<!doctype html public "-//w3c//dtd html 4.01 transitional//en" "http://www.w3.org/tr/html4/loose.dtd">

<html>

<head>

<meta http-equiv="content-type" content="text/html; charset=utf-8">

<title>untitled document</title>

</head>

 

<body>

 

<div id="contact_form">

  <form id="contactform" method="post" action="contact_form.php">

    <table width="670" border="1">

      <tr>

        <td><label for="firstname"></label>

          <span id="sprytextfield1">

          first name:<br />

          <input type="text" name="firstname" id="firstname" />

          <span class="textfieldrequiredmsg">a value required.</span></span></td>

      </tr>

      <tr>

        <td><p>email address:</p></td>

      </tr>

      <tr>

        <td><label for="lastname"></label>

          <span id="sprytextfield2">

          <input type="text" name="emailaddress" id="emailaddress" />

          <span class="textfieldrequiredmsg">a value required.</span><span class="textfieldinvalidformatmsg">invalid format.</span></span></td>

      </tr>

      <tr>

        <td><p>message:</p></td>

      </tr>

      <tr>

        <td><label for="message"></label>

          <span id="sprytextarea1">

          <textarea name="message" id="message" cols="45" rows="5"></textarea>

          <span class="textarearequiredmsg">a value required.</span></span></td>

      </tr>

      <tr>

      </tr>

      <tr>

        <td><input type="submit" name="submit" id="submit" value="send message" /></td>

      </tr>

      <tr>

 

      </tr>

    </table>

  </form>

</div>

</body>

</html>



More discussions in Dreamweaver support forum


adobe

Comments