www.webdeveloper.com
Results 1 to 2 of 2

Thread: PHP Contact form file

  1. #1

    PHP Contact form file

    I have devloped a contact form with PHP code. It work perfectly. when you submit the form all the information e-mail to you perfectly. After submitting the contact form it will take you back to you same contact page. Know want to make some changes in it. When some one submit the contact form a message appear "Thanks for contacting us we will reply you withing in 5 business days" and then return to you on contact page. I try to modify the code myself but can't able to do that.
    PHP CODE:



    PHP Code:
    <?php
        
        
    if(!$_POST) exit;
        
        
    $email $_POST['email'];
        
        
        
    //$error[] = preg_match('/\b[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b/i', $_POST['email']) ? '' : 'INVALID EMAIL ADDRESS';
        
    if(!eregi("^[a-z0-9]+([_\\.-][a-z0-9]+)*" ."@"."([a-z0-9]+([\.-][a-z0-9]+)*)+"."\\.[a-z]{2,}"."$",$email )){
            
    $error.="Invalid email address entered";
            
    $errors=1;
        }
        if(
    $errors==1) echo $error;
        else{
            
    $values = array ('URL','email','Keyword','Title');
            
    $required = array('URL','email','Keyword','Title');
             
            
    $your_email "info@bannistermarketinggroup.co.uk";    
            
    $email_subject "Bannister Marketing Group: ".$_POST['subject'];
            
    $email_content "Following is the keyword report:\n";
            
            foreach(
    $values as $key => $value){
              if(
    in_array($value,$required)){
                if (
    $key != 'subject' && $key != 'company') {
                  if( empty(
    $_POST[$value]) ) { echo 'PLEASE FILL IN REQUIRED FIELDS'; exit; }
                }
                
    $email_content .= $value.': '.$_POST[$value]."\n";
              }
            }
             
            if(@
    mail($your_email,$email_subject,$email_content)) {
                
    //echo 'thanks you we receive report witing 24hr';
                
    header("Location:http://bannistermarketinggroup.co.uk/site_optimization/");
                exit();
                
            } 
    //else {
                //echo 'ERROR!';
            //}
        
    }
        
    ?>
    **HTML CODE**



    HTML Code:
    <form action="contact.php" method="post">
                        	<Div class="fieldbox">
                            	<div class="textname">URL:</div>
                                <div class="field"><input type="text" id="URL" name="URL" /></div>
                                <div class="******"><img src="images/URLicon.jpg" /></div>
                            </Div>
                            
                            <Div class="fieldbox">
                            	<div class="textname">Title:</div>
                                <div class="field"><input id="Title" type="text" name="Title" /></div>
                                <div class="******"><img src="images/titleicon.jpg" /></div>
                            </Div>
                            
                              <Div class="fieldbox">
                            	<div class="textname">Keyword:</div>
                                <div class="field"><input id="Keyword" type="text" name="Keyword" />  </div>
                                <div class="******"><img src="images/keywordicon.jpg" /></div>
                            </Div>
                            
                            <Div class="fieldbox">
                            	<div class="textname">E-mail:</div>
                                <div class="field"><input id="name" type="text" name="email" />  </div>
                                <div class="******"><img src="images/emailicon.jpg" /></div>
                            </Div>
                            
                            <div class="button">
                            <input type="image" type="text" src="images/submit.jpg" />	
                            </div>
                            </form>

    Any once can help me please.Need to done it as soon as possible.

  2. #2
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,611
    Instead of using the header() function to do your redirect, have the success message instead be output as part of a HTML page which includes a "meta refresh tag" in the head section which includes the redirect URL.
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

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



Recent Articles