Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7

Thread: Contact Form

  1. #1
    New Coder
    Join Date
    Aug 2012
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Contact Form

    please can someone help me!!

    i have this contact form but : www.suenomaintenance.com/contact.html

    i need to get it working!!

    Code:
                       <h2>Contact Form</h2>                      
                            	<form action="" id="form">
                                   <div class="container1">
                                        <div class="col-3">
                                             <div class="h"><input  type="text" value="Name:" onblur="if(this.value=='') this.value='Name:'" onfocus="if(this.value =='Name:' ) this.value=''"  /></div>
                                             <div class="h"><input  type="text" value="E-mail:" onblur="if(this.value=='') this.value='E-mail:'" onfocus="if(this.value =='E-mail:' ) this.value=''"  /></div>
                                             <div class="h"><input  type="text" value="Telephone:" onblur="if(this.value=='') this.value='Telephone:'" onfocus="if(this.value =='Fax:' ) this.value=''"  /></div>
                                        </div>
                                        <div class="col-4">
                                          <textarea rows="40" cols="30" onblur="if(this.value=='') this.value='Message:'" onfocus="if(this.value =='Message:' ) this.value=''"  >Message:</textarea>
                                            <div class="container">
                                                <div class="fright">
                                                    <a href="#" class="link-1" onclick="document.getElementById('form').reset()"><em><b>reset</b></em></a>
                                                    <div class="indent-2"><a href="#" class="link-1" onclick="document.getElementById('form').submit()"><em><b>submit</b></em></a></div>
                                                </div>
                                            </div>
                                        </div>
                                        <br class="clear" />
                                   </div>
                               </form>

  • #2
    New Coder
    Join Date
    Aug 2012
    Location
    New Zealand
    Posts
    52
    Thanks
    2
    Thanked 4 Times in 4 Posts
    you havent got an action set for the form? have you got any php to it?

  • #3
    New Coder
    Join Date
    Aug 2012
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I'M just about to kill myself!!

    cant get my bloody contact form to work!!

    i keep getting a 405 verb used to access this page!
    no email recieved or sent.. and page not redirected as expected?
    help help help

    php code:

    Code:
    <?php
    $field_name = $_POST['cf_name'];
    $field_email = $_POST['cf_email'];
    $field_email = $_POST['cf_telephone'];
    $field_message = $_POST['cf_message'];
    
    $mail_to = 'Patrick@suenovillas.co.uk';
    $subject = 'Message from a site visitor '.$field_name;
    
    $body_message = 'From: '.$field_name."\n";
    $body_message .= 'E-mail: '.$field_email."\n";
    $body_message .= 'Telephone: '.$field_email."\n";
    $body_message .= 'Message: '.$field_message;
    
    $headers = 'From: '.$field_email."\r\n";
    $headers .= 'Reply-To: '.$field_email."\r\n";
    
    $mail_status = mail($mail_to, $subject, $body_message, $headers);
    
    if ($mail_status) { ?>
    	<script language="javascript" type="text/javascript">
    		alert('Thank you for the message. We will contact you shortly.');
    		window.location = 'http://www.suenomaintenance.com/contact.html/';
    	</script>
    <?php
    }
    else { ?>
    	<script language="javascript" type="text/javascript">
    		alert('Message failed. Please, send an email to patrick@suenovillas.co.uk');
    		window.location = 'http://www.suenomaintenance.com/contact.html/';
    	</script>
    <?php
    }
    ?>

    html code

    Code:
    <h2>Contact Form</h2>                      
                            	<form action="contact.php" method="POST" id="form">
                                   <div class="container1">
                                        <div class="col-3">
                                             <div class="h"><input name="cf_name" type="text" value="Name:" onblur="if(this.value=='') this.value='Name:'" onfocus="if(this.value =='Name:' ) this.value=''"  /></div>
                                             <div class="h"><input name="cf_email" type="text" value="E-mail:" onblur="if(this.value=='') this.value='E-mail:'" onfocus="if(this.value =='E-mail:' ) this.value=''"  /></div>
                                             <div class="h"><input name="cf_telephone" type="text" value="Telephone:" onblur="if(this.value=='') this.value='Telephone:'" onfocus="if(this.value =='Telephone:' ) this.value=''"  /></div>
                                        </div>
                                        <div class="col-4">
                                          <textarea name="cf_message" rows="40" cols="30" onblur="if(this.value=='') this.value='Message:'" onfocus="if(this.value =='Message:' ) this.value=''"  >Message:</textarea>
                                            <div class="container">
                                                <div class="fright">
                                                    <a href="#" class="link-1" onclick="document.getElementById('form').reset()"><em><b>reset</b></em></a>
                                                    <div class="indent-2"><a href="#" class="link-1" onclick="document.getElementById('form').submit()"><em><b>submit</b></em></a></div>
                                                </div>
                                            </div>
                                        </div>
                                        <br class="clear" />
                                   </div>
                               </form>

  • #4
    New Coder
    Join Date
    Aug 2012
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts
    does no one know how to resolve this issue?

  • #5
    Senior Coder
    Join Date
    Apr 2011
    Location
    London, England
    Posts
    2,120
    Thanks
    15
    Thanked 354 Times in 353 Posts
    PHP Code:
    $field_email $_POST['cf_email'];
    $field_email $_POST['cf_telephone']; 
    You're setting the email address to the telephone number.. mail() will probably still return true, but..
    Last edited by AndrewGSW; 08-21-2012 at 05:14 PM.
    "I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
    Validate your HTML and CSS

  • #6
    New Coder
    Join Date
    Aug 2012
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Right got the form to process... however i am now not recieveing any emails via the contact form

    help

    help

    help

  • #7
    New Coder
    Join Date
    Aug 2012
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Way hay!! Got it all working correctly!!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •