Results 1 to 13 of 13

 

Thread: Creating a web form

  1. #1
    Merchant User

    Status
    Offline
    Join Date
    Apr 2006
    Location
    Cheshire
    Posts
    1,441
    Thanks
    16
    Thanked 18 Times in 17 Posts


    Can anyone help, need to create a basic webform for one of my single page html sites, just so visitors can contact me without me using my email address as a clicky, or having it within the code to avoid spam.

    I just need boxes so the visitor adds their name, email, message etc and then just clicks submit and hey-presto, i receive it in my email with a subject title i choose.

    Can anyone advise on the easiest way of doing this? I'm just using shared hosting.

    Considering the websites i've built, i can't believe i don't know this!!!

  2. #2
    Registered User

    Status
    Offline
    Join Date
    Sep 2007
    Posts
    1,351
    Thanks
    43
    Thanked 72 Times in 63 Posts
    <html>
    <body>
    <form action="MAILTO:someone@w3schools.com" method="post" enctype="text/plain">

    <h3>This form sends an e-mail to W3Schools.</h3>
    Name:<br>
    <input type="text" name="name"
    value="yourname" size="20">
    <br>
    Mail:<br>
    <input type="text" name="mail"
    value="yourmail" size="20">
    <br>
    Comment:<br>
    <input type="text" name="comment"
    value="yourcomment" size="40">
    <br><br>
    <input type="submit" value="Send">
    <input type="reset" value="Reset">

    </form>
    </body>
    </html>

  3. #3
    Registered User

    Status
    Offline
    Join Date
    Sep 2007
    Posts
    1,351
    Thanks
    43
    Thanked 72 Times in 63 Posts

  4. #4
    Merchant User

    Status
    Offline
    Join Date
    Apr 2006
    Location
    Cheshire
    Posts
    1,441
    Thanks
    16
    Thanked 18 Times in 17 Posts
    Thanks mate, my only concern i guess with a html coded form is that the email address is visable to bots etc.

    I've seen a .pl option, but not sure if thats any more protected?!?!

  5. #5
    Registered User

    Status
    Offline
    Join Date
    Sep 2007
    Posts
    581
    Thanks
    0
    Thanked 0 Times in 0 Posts
    ian ..
    drop me an email and i'll sort you out a php form script

    chrisyates23 AT gmail dot com

  6. #6
    Registered User

    Status
    Offline
    Join Date
    Mar 2007
    Posts
    341
    Thanks
    13
    Thanked 3 Times in 3 Posts
    I'm in the process of doing a small corporate site and need to do a similar contact type page with the ability to attach a document file too.

    Is having the email in the html code a major issue?

    Geoff

  7. #7
    Registered User

    Status
    Offline
    Join Date
    Sep 2007
    Posts
    581
    Thanks
    0
    Thanked 0 Times in 0 Posts
    its not an issue unless you want tons of unwanted email

  8. #8
    Registered User

    Status
    Offline
    Join Date
    Mar 2007
    Posts
    341
    Thanks
    13
    Thanked 3 Times in 3 Posts
    hmmmmm.....i suspect you have that the wrong way round cyates

    So what is the best way of avoiding this? PHP?

  9. #9
    Registered User

    Status
    Offline
    Join Date
    Sep 2007
    Posts
    1,351
    Thanks
    43
    Thanked 72 Times in 63 Posts
    E-mail Form Code (contact.php)
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Email Form </title>
    </head>
    <body>

    <form method="post" action="sendeail.php">

    <!-- DO NOT change ANY of the php sections -->
    <?php
    $ipi = getenv("REMOTE_ADDR");
    $httprefi = getenv ("HTTP_REFERER");
    $httpagenti = getenv ("HTTP_USER_AGENT");
    ?>

    <input type="hidden" name="ip" value="<?php echo $ipi ?>" />
    <input type="hidden" name="httpref" value="<?php echo $httprefi ?>" />
    <input type="hidden" name="httpagent" value="<?php echo $httpagenti ?>" />


    Your Name: <br />
    <input type="text" name="visitor" size="35" />
    <br />
    Your Email:<br />
    <input type="text" name="visitormail" size="35" />
    <br /> <br />
    <br />
    Attention:<br />
    <select name="attn" size="1">
    <option value=" Sales n Billing ">Sales n Billing </option>
    <option value=" General Support ">General Support </option>
    <option value=" Technical Support ">Technical Support </option>
    <option value=" Webmaster ">Webmaster </option>
    </select>
    <br /><br />
    Mail Message:
    <br />
    <textarea name="notes" rows="4" cols="40"></textarea>
    <br />
    <input type="submit" value="Send Mail" />
    <br />
    Free Code at: <a href="http://www.ibdhost.com/contact/">ibdhost.com/contact/</a>
    </form>

    </body>
    </html>


    --------------------------------------------------------------------------------


    Code for sendeail.php
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Sendemail Script</title>
    </head>
    <body>

    <!-- Reminder: Add the link for the 'next page' (at the bottom) -->
    <!-- Reminder: Change 'YourEmail' to Your real email -->

    <?php

    $ip = $_POST['ip'];
    $httpref = $_POST['httpref'];
    $httpagent = $_POST['httpagent'];
    $visitor = $_POST['visitor'];
    $visitormail = $_POST['visitormail'];
    $notes = $_POST['notes'];
    $attn = $_POST['attn'];


    if (eregi('http:', $notes)) {
    die ("Do NOT try that! ! ");
    }
    if(!$visitormail == "" && (!strstr($visitormail,"@") || !strstr($visitormail,".")))
    {
    echo "<h2>Use Back - Enter valid e-mail</h2>\n";
    $badinput = "<h2>Feedback was NOT submitted</h2>\n";
    echo $badinput;
    die ("Go back! ! ");
    }

    if(empty($visitor) || empty($visitormail) || empty($notes )) {
    echo "<h2>Use Back - fill in all fields</h2>\n";
    die ("Use back! ! ");
    }

    $todayis = date("l, F j, Y, g:i a") ;

    $attn = $attn ;
    $subject = $attn;

    $notes = stripcslashes($notes);

    $message = " $todayis [EST] \n
    Attention: $attn \n
    Message: $notes \n
    From: $visitor ($visitormail)\n
    Additional Info : IP = $ip \n
    Browser Info: $httpagent \n
    Referral : $httpref \n
    ";

    $from = "From: $visitormail\r\n";


    mail("YourEmail", $subject, $message, $from);

    ?>

    <p align="center">
    Date: <?php echo $todayis ?>
    <br />
    Thank You : <?php echo $visitor ?> ( <?php echo $visitormail ?> )
    <br />

    Attention: <?php echo $attn ?>
    <br />
    Message:<br />
    <?php $notesout = str_replace("\r", "<br/>", $notes);
    echo $notesout; ?>
    <br />
    <?php echo $ip ?>

    <br /><br />
    <a href="contact.php"> Next Page </a>
    </p>

    </body>
    </html>

  10. #10
    Merchant User

    Status
    Offline
    Join Date
    Apr 2006
    Location
    Cheshire
    Posts
    1,441
    Thanks
    16
    Thanked 18 Times in 17 Posts
    Well done that man, thanks Cheapdvds (thx also to cyates for the offer).

    The .php option works well, just tested it and can tailor that to suit, but does that get around the issue of visable email address code for bots? Would .pl offer a more secure coding option or can i change the CHMOD for the .php file to prevent access to view (i presume not otherwise the code won't run!)

  11. #11
    Registered User

    Status
    Offline
    Join Date
    Oct 2003
    Posts
    124
    Thanks
    0
    Thanked 0 Times in 0 Posts
    easier still, stick with html but code your email address as a string of html characters - never yet met a spammer that could handle that.

    eg: mailto:mick@we

    view source to see what I mean.

    regards

    Mick

  12. #12
    Merchant User

    Status
    Offline
    Join Date
    Apr 2006
    Location
    Cheshire
    Posts
    1,441
    Thanks
    16
    Thanked 18 Times in 17 Posts
    That doesn't make sense to me, your email address isn't complete?!?!

  13. #13
    Registered User

    Status
    Offline
    Join Date
    Oct 2003
    Posts
    124
    Thanks
    0
    Thanked 0 Times in 0 Posts
    that's because it was late and I couldn't be bothered looking up all the html character codes to complete it.



Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Help creating web banners please?
    By V2U in forum Affiliate Marketing Lounge
    Replies: 3
    Last Post: 15-05-06, 10:43 AM
  2. New merchant: Travel Insurance Web
    By Vivid in forum Affiliate Marketing Lounge
    Replies: 0
    Last Post: 07-03-06, 04:09 PM
  3. Replies: 1
    Last Post: 04-06-03, 02:55 AM

Bookmarks

Posting Permissions

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

Content Relevant URLs by vBSEO 3.5.0 RC2