Contact Form in HTML Site

Discussion in 'Web Design and Development' started by jdl8422, Jun 15, 2007.

  1. jdl8422 macrumors 6502

    jdl8422

    Joined:
    Jul 5, 2006
    Location:
    Louisiana
    #1
    I am designing a site in dreamweaver using HTML. I have all the pages done except a contact page. I know how to insert a form and get it the way I want it to look. My problem is function. I know there has to a script, like PHP, but I am not sure if I need anything else. Like a service to send the email. Please Help.
     
  2. timmillwood macrumors 6502a

    Joined:
    Apr 7, 2006
    #2
    Try something like

    Code:
    
    <?php
    if(!$visitormail == "" && (!strstr($visitormail,"@") || !strstr($visitormail,"."))) 
    {
    echo "<p align=\"center\">You need to enter a valid e-mail address<br><a href=\"index.php\">Click here</a> to go back</p>\n";
    }
    else
    {
    if(empty($visitor) || empty($visitormail) || empty($notes )) {
    echo "<p align=\"center\">Please fill in the form<br><a href=\"index.php\">Click here</a> to go back</p>\n";
    }
    else
    {
    $todayis = date("l, F j, Y, g:i a") ;
    
    $attn = $attn ; 
    $subject = $attn; 
    
    $notes = stripcslashes($notes); 
    
    $message = "Sent on: $todayis [GMT] \n
    Regarding: $attn \n
    Enquiry: $notes \n 
    From: $visitor ($visitormail)\n
    Browser Info: $httpagent \n
    ";
    
    $from = "From: $visitormail\r\n";
    
    
    mail("YOUR EMAIL ADDRESS", $subject, $message, $from);
    
    if($cc == "yes") {
    mail($visitormail, $subject, $message, "From:YOUR EMAIL ADDRESS\r\n");
    
    $copy = "This has been copied to $visitormail";
    }
    ?>
        
        </p>
    </div>
    <p align="center"><b>
    Thank you for you email, we will try to reply to the address <?php echo $visitormail ?> asap. </b>
    
    <?php
    }
    }
    ?>
    
     
  3. jdl8422 thread starter macrumors 6502

    jdl8422

    Joined:
    Jul 5, 2006
    Location:
    Louisiana
    #3
    ok, so i make a page with the PHP and save it but does it have to be named anything special. Also how does the script interact with the form. Im sorry if I do not know what i am talking about, I am pretty new to PHP and scripts
     
  4. janitorC7 macrumors 6502a

    janitorC7

    Joined:
    Feb 10, 2006
    Location:
    North Hollywood, CA
    #4
    no offense but I don't think that you have the experience to do this.

    if you trust me with information I would be more than happy to do it for you as it would only take me a few min.

    But just as easy would be using a web service such as My Contact Form.

    Which is step by step and does it for you, and then gives a snippet of code that you paste right into DW.

    Janitorc7
     
  5. jdl8422 thread starter macrumors 6502

    jdl8422

    Joined:
    Jul 5, 2006
    Location:
    Louisiana
    #5
    I wanted to know how to do it so I can do it on furture projects. I found a tutorial on how to do it and it did work. The only problem is when I put it on the table for existing site it doesnt work anymore. That is why i came here in the first place
     
  6. operator macrumors regular

    Joined:
    Oct 29, 2006
    Location:
    Canada
    #6
    THe logic behind most of these forms is simple. WHen the page loads, there is usually an "if" statement asking if the form has been submitted ... if so, then it process the form, and spits out a thank you message or something similar. If not, it will display the form. These are usually 'multipurpose' pages. It's sort of like have 2 pages built into the 1 file. Hope I didn't confuse you - I'm just trying to help you understand the logic.
     
  7. CanadaRAM macrumors G5

    CanadaRAM

    Joined:
    Oct 11, 2004
    Location:
    On the Left Coast - Victoria BC Canada
    #7
    How you do a form is dependant on the host server the site is on. You have to work with the tools that are installed on the server.

    What did your website host say when you called them?
     

Share This Page