6 Replies Latest reply on Jan 11, 2014 1:49 PM by osgood_

    email php/html

    polini48t Level 1

      dear fellow designers
      i have a php email code wich i can't get my head around
      is there anyone of u wich would like to help me on my code , it's one of the only codes i just cannot conquer

       

      so

       

      if u need the code of the current site , let me know

       

      yves martens belgium

        • 1. Re: email php/html
          Nancy OShea Adobe Community Professional & MVP
          1. Do you have an HTML contact form yet?
          2. Do you have a PHP script that references the form field names in your HTML form?  These must match exactly.
          3. Can you post the code you're using into a web forum reply?  Don't use email for this.  It won't come through.

           

           

           

          Nancy O.

          • 2. Re: email php/html
            polini48t Level 1

            i have the html script and the php script but there is something i do not see apperently

            • 3. Re: email php/html
              polini48t Level 1

              my php and html files

              <html xmlns="http://www.w3.org/1999/xhtml"><head>

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

              <title>Untitled Document</title>

              <script type="text/php">

              echo ('mail.php');

              </script>

              <script src="mail.php"></script>

              <script src="mail.css"></script>

              <style type="text/css">

               

               

              body {

                        background-image: url(images/bg.jpg);

                        width: 100%;

                        height: 100%;

                        background-repeat: no-repeat;

                        background-size: cover;

              }

               

               

              #container {

                        width: 900px;

                        margin: 0px auto;

              }

               

               

              #adress {

                        width: 375px;

                        margin-top: 50px;

                        float: left;

                        color: #FFF;

              }

               

               

              #contactform {

                        width: 425px;

                        height: 350px;

                        margin-top: 75px;

                        padding: 25px;

                        border: 2px solid #999;

                        float: right;

                        background:url(images/bg_textfield.jpg);

                        border-radius: 10px;

               

              }

               

               

              .clr-1 {font-size: 14px; color:#999;}

               

               

              .clr-2 {font-size: 16px; color:#FFF;}

               

               

              .clr-3 {font-size: 12px; color:#999;}

              a.clr-3:hover {text-decoration: underline; color:#999;}

              a.clr-3:link {text-decoration: none; color:#999;}

               

               

              .text-form {          color: #999;

              }

              #container #contactform form {

                        color: #F00;

                        font-size: 14px;

              }

              #apDiv1 {

                        position: absolute;

                        left: 38px;

                        top: 15px;

                        width: 68px;

                        height: 59px;

                        z-index: 1;

              }

                #apDiv2 {

                        position: absolute;

                        left: -139px;

                        width: 396px;

                        height: 25px;

                        z-index: 107;

                        margin-left: 50%;

                        backface-visibility: hidden;

                        bottom: 0px;

                        color: #CCC;

              </style>

              </head>

               

               

              <body>

               

               

              <!-- Start Container -->

              <div id="apDiv1"><a href="homepage.html"><img src="images/homebutton.png" width="60" height="49"></a></div>

              <div id="container">

              <!-- Start Left Section -->

                        <section id="adress">

                            <img src="images/logo_idsigns.png" width="300" height="200">

                                 

                          <dd class="clr-2">Adres voorbehouden voor clienten</dd>

                          <dd class="clr-2">B-3512 Hasselt</dd>

                          <dd class="clr-2">Tel: +32(0)123/45.67.89</dd>

                        

                          <dd class="clr-2">Web: <a href="http://www.interface-designs.com" target="new" class="clr-2">www.interface-designs.com</a></dd>

                </section><div id="apDiv2">property of interface-designs.com Adobe licensed</div>

              <!-- Start Right Section -->

                        <section id="contactform">

                  <form action="mail.php" method="POST" id="mail.php">

                                  <span class="text-form">Naam:</span><br>

                                <input type="text" name="name" placeholder="Naam en Voornaam">*<br>

                                  <span class="text-form">E-mail:</span><br>

                                <input type="text" name="email" placeholder="Voorbeeld@email.com">*<br>

                                  <span class="text-form">Prioriteit</span><br>

                                            <select name="priority" size="1">

                                                      <option value="Low">Laag</option>

                                                      <option value="Normal">Normaal</option>

                                                      <option value="High">Hoog</option>

                                                      <option value="Emergency">Noodgeval</option>

                                            </select><br>

                                  <span class="text-form">Type</span><br>

                                            <select name="type" size="1">

                                                      <option value="new">Nieuwe Website</option>

                                                      <option value="update">Website Update</option>

                                                      <option value="change">Wijziging Informatie</option>

                                                      <option value="addition">Toevoeging Informatie</option>

                                            </select><br>

                                  <span class="text-form">Message</span><br>

                                            <textarea name="message" placeholder="Typ hier uw bericht." rows="7" cols="50"></textarea><br>

                                  <input type="submit" value="Verzenden"><input type="reset" value="Reset"> (Velden met * zijn verplicht!)

                        </form>

                  </section>

               

               

              </div>

               

               

               

               

              </body></html>

               

               

              <?php

              $name = $_POST['name'];

              $email = $_POST['email'];

              $priority = $_POST['priority'];

              $type = $_POST['type'];

              $message = $_POST['message'];

              $formcontent=" From: $name \n Priority: $priority \n Type: $type \n Message: $message";

              $recipient = "info@interface-designs.com";

              $subject = "Contact Form";

              $mailheader = "From: $email \r\n";

              if ($mail_status) { ?>

                        <script language="javascript" type="text/javascript">

                                  alert('Thank you for the message. We will contact you shortly.');

                                  window.location = 'emailform.html';

                        </script>

              <?php

              }

              else { ?>

                        <script language="javascript" type="text/javascript">

                                  alert('Message failed. Please, try again');

                                  window.location = 'emailform.html';

                        </script>

              <?php

              }

              ?>

              • 4. Re: email php/html
                osgood_ Level 8

                Just send the form back to the same page - change emailform.html to emailform.php and the action of the form to emailform.php.

                 

                Use the page code/form below which submits back to itself and if there are any empty form fields that are required flags them up before the form will send.

                 

                Add recipient email address where the xxxxxx are:

                 

                $recipient = "xxxxxxxx@xxxxxxxxxxxx";

                 

                 

                 

                <?php

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

                $name = $_POST['name'];

                $email = $_POST['email'];

                if(empty($name) || empty($email)) {

                $formErrors = "<p class='callout'>Message failed - please supply the required field details</p>";

                }

                $priority = $_POST['priority'];

                $type = $_POST['type'];

                $message = $_POST['message'];

                // Recipient/Subject/Sender

                $recipient = "xxxxxxxx@xxxxxxxxxxxx";

                $subject = "Email Message";

                $sender = "From:".$_POST['email']."\r\n";

                // The Message

                $feedback = "Please contact me regarding the following enquiry.\n\n";

                $feedback .= "Name: $name\n\n";

                $feedback .= "Email Address: $email\n\n";

                $feedback .= "Priority: $priority\n\n";

                $feedback .= "Type: $type\n\n";

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

                if(!isset($formErrors)) {

                $mail = mail($recipient, $subject, $feedback, $sender);

                }

                }

                ?>

                 

                <!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>

                <style>

                .callout {

                    color:#900;

                }

                </style>

                </head>

                 

                <body>

                <?php if(isset($formErrors)) {

                        echo $formErrors;

                    }

                ?>

                <?php if($mail) {

                echo "<p class='callout'>Thank you - the message was sent successfully.</p>";

                    }

                    ?>

                 

                <form action="emailform.php" method="POST" id="mail.php">

                <span class="text-form">Naam:</span><br>

                <input type="text" name="name" placeholder="Naam en Voornaam">*<br>

                <span class="text-form">E-mail:</span><br>

                <input type="text" name="email" placeholder="Voorbeeld@email.com">*<br>

                <span class="text-form">Prioriteit</span><br>

                <select name="priority" size="1">

                <option value="Low">Laag</option>

                <option value="Normal">Normaal</option>

                <option value="High">Hoog</option>

                <option value="Emergency">Noodgeval</option>

                </select><br>

                <span class="text-form">Type</span><br>

                <select name="type" size="1">

                <option value="new">Nieuwe Website</option>

                <option value="update">Website Update</option>

                <option value="change">Wijziging Informatie</option>

                <option value="addition">Toevoeging Informatie</option>

                </select><br>

                <span class="text-form">Message</span><br>

                <textarea name="message" placeholder="Typ hier uw bericht." rows="7" cols="50"></textarea><br>

                <input type="submit" name="submit" value="Verzenden">

                <input type="reset" value="Reset"> (Velden met * zijn verplicht!)

                </form>

                </body>

                </html>

                • 5. Re: email php/html
                  polini48t Level 1

                  thanks man i'll be looking at it tommorow , pretty late in mid-europe , i'll let u know if my problemm is solved cheers

                  • 6. Re: email php/html
                    osgood_ Level 8

                    I'm in the UK so we are about on the same time zone...........think you're 1 hour ahead.

                     

                    Post back if you run into trouble.