Search This Blog

Tuesday, November 6, 2012

Creating PHP contact form using html pages

Welcome to designers blog here i have posted how to send email from php and redirect page using

header('Location: register.html'); function

Contact us.html Page:


 <form action="contactus.php" method="post" onsubmit="MM_validateForm('fname','','R','lname','','R','email','','RisEmail','ccode','','RisNum','acode','','R','number','','RisNum','msg','','R');return document.MM_returnValue">
                <ul>
                 
                  <li><br />
  <span class="star_link">*</span> Salutation</li>
                  <li>
  <input type="radio"  Value="Mr" name="salutation" size="40"/>
                    Mr
                    <input type="radio" value="Mrs" name="salutation" size="40"/>
                    Mrs
                    <input type="radio" value="Miss" name="salutation" size="40"/>
                    Miss
                    <input type="radio" value="Ms" name="salutation" size="40"/>
                    Ms         </li>
                  <li>
                    <span class="star_link">*</span> First name:<br />
                    <br />
                    <input name="fname" type="text" id="fname" size="40"/>
                    <br />
                    </li>
                  <li>
                  Last Name:  <span class="star_link">*</span> <br />
                  <br />
                    <input name="lname" type="text" id="lname"  size="40"/>
                    <br />
                    </li>
                   
                        <li>
                       
                  E-mail Address: <span class="star_link">*</span> <br />
                    <br />
                    <input name="email" type="text" id="email" size="40"/>
                    <br />
                    </li>
                  <li>Phone Number <span class="star_link">*</span></li>
                  <li>
                   
                    <input name="ccode" type="text" id="ccode" onblur="if(this.value==''){this.value='Country Code'}"
                   
                   onclick="if(this.value=='Country Code'){this.value=''}" value="Country Code" size="20" maxlength="20" >
                    <input name="acode" type="text" id="acode" onblur="if(this.value==''){this.value='Area Code'}"
                   
                   onclick="if(this.value=='Area Code'){this.value=''}" value="Area Code" size="20" maxlength="20" />
                    <input name="number" type="text" id="number" onblur="if(this.value==''){this.value='Number'}"
                   
                   onclick="if(this.value=='Number'){this.value=''}" value="Number" size="20" maxlength="20">
                    <br />
                    <br />
                  </li>
                  <li >
          How can we help you? <span class="star_link">*</span>
                   <textarea name="msg" cols="34" rows="10" id="msg" style="margin:0px 0px 0px 10px;"> </textarea>
                    </li>
                  <li>The following information is required for regulatory purpose </li>
                  <li></li>
                  <li><strong>I am a resident of <span class="star_link">*</span></strong>
                   <select name="resi">
                   <option>Asia</option>
                       <option></option>
                           <option></option>
                  
                   </select>
                  
                    <select name="resia">
                   <option> Asia link 1</option>
                       <option></option>
                           <option></option>
                  
                   </select>
                 
                  
                  
                   </li>
                  <li></li>
                   <li><strong>I am a citizen of <span class="star_link">*</span>  </strong> &nbsp;&nbsp;
                     <select name="region">
                   <option selected="selected">Select a region</option>
                       <option>link1</option>
                           <option>link2</option>
                  
                   </select>
                  
                    <select name="regions">
                      <option>link3</option>
                           <option>link4</option>
</select>
                
                   </li>
                   <li></li>
                   <li><input type="checkbox" />
                    <span class="star_link">*</span> Required a Filed</li>
                  <li>

                  </li>
                  <li>
                    <input type="submit" />
                    <input type="reset" />
                    </li>
                  </ul>
                </form>


contactus.php page:

 <?php
           

            $to="xxx@gmail.com";
            $subject="Enquiry Form";
            $subjects = "New A/C";
            $kumar= "M3MoneyManager";
             $salutations=$_POST['salutation'];
            $fname=$_POST['fname'];
            $lname=$_POST['lname'];
            $email=$_POST['email'];
            $ccode=$_POST['ccode'];
            $acode=$_POST['acode'];
            $number=$_POST['number'];
            $msg=$_POST['msg'];
            $resi=$_POST['resi'];
            $resia=$_POST['resia'];
            $region=$_POST['region'];
            $regions=$_POST['regions'];
            $headerss="From:".$kumar;
            $headers="From:".$fname;
            mail($to,$subject,"Salutation:$salutations\nFirst name:$fname\nLast name: $lname\nEmail:$email\n Phone number:$ccode\n Area Code:$acode\n Number: $number \nHow can we help you :$msg\n I am a resident of: $resi $resia\n I am a citizen of :$region $regions",$headers) && mail($email,$subjects,"$fname.We are pleased to confirm that you have been registered for the Opening the account.\n we will get back you soon",$headerss);
            header('Location: register.html');
         
   ?>       


 Register.Html page

Thank you For opening the A/c . A confirmation email has been sent to the email address that you   have provided during registration.






No comments:

Post a Comment

Validating to select in sequencial order using angular

    < input type = "checkbox" (change) = "handleSelectTaskItem($event, taskItem)" [checked] = " taskItem . i...