1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Help with forms and time

Discussion in 'Web Design & Development' started by howard.a.s, Oct 8, 2008.

Thread Status:
Not open for further replies.
Advertisement
  1. howard.a.s

    howard.a.s Thread Starter

    Joined:
    Jul 22, 2005
    Messages:
    496
    Hi all.

    Here is my first question.

    I am currently building a website and would like to add a form to one of my pages, allowing potential clients to contact me. I have the basic code for a form and have posted it below, but don't know how to get it working so that it sends the completed information to me. I mean, where do I add in the email address to which the completed information should be sent?

    Can you tell if it's possible to get this working. If so, how.

    If not, could you tell me where I can get a working version of a similar form script that I could easily adapt to meet my requirements. Please bear in mind that I am not tremendously tekkie, so any advice needs to be quite basic.

    Can I just set up the form so that it sends the completed information straight to my email in-box, or do I have to have an .asp mail handler set up on a server?

    Anyway, here is the code for the current form:

    <form enctype="multipart/form-data" action="" method="post" onsubmit="return emailCheck(this.from.value)">
    <table class="maintext" width="80%" bgcolor="#ADDDEF" align="center" border="0" cellspacing="5" cellpadding="5">
    <tr>
    <td>Your Full Name:</td>
    <td> <input type="text" name="name" size="40" maxlength="100" value=""> </td>
    </tr>
    <tr>
    <td>Sex:</td>
    <td>Male:<input type="radio" name="sex" value="male" > Female:<input type="radio" name="sex" value="female" ></td>
    </tr>
    <tr>
    <td>Age:</td>
    <td><input type="text" name="age" value="" size="2" maxlength="3"></td>
    </tr>
    <tr>
    <td>Email address:</td>
    <td><input type="text" name="email" value="" size="40" maxlength="100"></td>
    </tr>
    <tr>
    <td align="left">Confirm Email address:</td>
    <td><input type="text" name="email_confirm" value="" size="40" maxlength="100"></td>
    </tr>

    <tr>
    <td>Postal address:</td>
    <td><textarea name="address" cols="30" rows="8"></textarea>
    </td>
    </tr>
    <tr>
    <td>Postcode:</td>
    <td><input type="text" value="" name="postcode" size:"8" maxlength="8">
    </td>
    </tr>
    <tr>
    <td>Occupation:</td>
    <td><input type="text" name="occupation" value="" size="40" maxlength="100"></td>
    </tr>
    <tr>
    <td>Marital Status:</td>
    <td>
    <select name="marital_status">
    <option >single</option>
    <option >married</option>
    <option >divorced</option>
    <option >widowed</option>
    </select>
    </td>
    </tr>
    <tr>
    <td colspan="2">Please also include any other information you feel you can tell me about yourself, and of course, what you would like to look at / work with during our sessions together:</td>
    </tr>
    <tr>
    <td colspan="2"><textarea name="other_information" cols="60" rows="30"></textarea></td>
    </tr>
    <tr>
    <td colspan="2"><input type="checkbox" name="terms" value="terms agreed" ><b>I have read the <a href="terms.php" target="_blank" class="prev_next">terms of service</a></b> (link opens a new window)</td>
    </tr>
    <tr>
    <td colspan="2"><input name="sent" type="submit" value="Send to Email"></td>
    </tr>
    </table>

    </form>

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


    Here is my second question.

    I would like to add the current time and date to my web page. What is the easiest way to achieve this?



    Any help and advice greatly appreciated.
     
  2. Techmonkeys

    Techmonkeys

    Joined:
    Feb 10, 2005
    Messages:
    625
    Take a look here http://www.tizag.com/htmlT/forms.php

    Make note of the part that has the action for the form

    Code:
    <form method="post" action="mailto:[email protected]">
    
    You can put your email there.

    As for the time, if you want live time, so it is ticking you will need to use something like javascript
     
  3. TheRobatron

    TheRobatron

    Joined:
    Oct 25, 2007
    Messages:
    551
    You can easily print the current date and time using PHP (as long as you don't want it 'ticking') using this code:
    PHP:
    <?php echo date("l j F H:i"); ?>
    Today that code would produce Thursday 9 October 19:49, but you can change around how you want it presented by changing the letters sent to the date function, documented here (any letters that are recognised in the string sent are replaced with their time values; any that are not recognised are ignored and stay there, such as spaces or colons).
     
  4. howard.a.s

    howard.a.s Thread Starter

    Joined:
    Jul 22, 2005
    Messages:
    496
    All the information is very much appreciated and is helping me to decide upon the best way to process my form information.

    Incidentally, I have now found out from my web host that there is a asp script already set up on my hosting which I can use to process form data. There servers are Microsoft.

    I couldn't seem to get clear whether I need one asp script in my hosting account for each individual form that I use, or whether one asp script processes all. Can you tell me?

    In the event that I do require more than one, is there a standard script that I can get hold of that will process information, and that I can just upload to my hosting? If so, where would I get it?
     
  5. TheRobatron

    TheRobatron

    Joined:
    Oct 25, 2007
    Messages:
    551
    It really depends on how the script is written: if there is already a generic script on the server, you should be able to call it from any form and it will work. There are a lot of form processing scripts on the web, just google it.
     
  6. Sponsor

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/757279

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice