Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: Need a contact form....

  1. #1
    Join Date
    May 2007
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Need a contact form....

    but not any normal one.

    What im after is a full contact form with name, email, subject and of course message. But just before the message box i want another drop down menu that will ask the to select an option i.e website issues, forum issues ect.

    When they select the relivent option it'll then select the correct email address to send there email to.

    Anybody able to knock me one up? would be very very grateful

    Thanks

  2. #2
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    Well, the form itself is done using HTML, but in order to send the email, you will need to use a server side script (PHP, ASP, etc). If you have PHP installed on your server, you could use the code listed here:

    http://www.dynamicdrive.com/forums/s...75&postcount=3

    You can simply modify the html code to include a select box like the following:

    Code:
    <select name="to">
    <option value="me@domain.com">Website Stuff</option>
    <option value="you@domain.com">Something else</option>
    <option value="blah@something.com">Yet Something else</option>
    </select>
    Hope this helps.

    //EDIT: the only part of the script that should be used is the PHP script. For more info, look at Mike's post below.
    Last edited by thetestingsite; 05-12-2007 at 02:16 PM.
    "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
    TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design

  3. #3
    Join Date
    Dec 2004
    Location
    UK
    Posts
    2,358
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by k3v1n View Post
    [I need a contact form] but not any normal one.

    What im after is a full contact form with name, email, subject and of course message. But just before the message box i want another drop down menu that will ask the to select an option i.e website issues, forum issues ect.
    The use of a select element (as demonstrated previously), or a series of radio buttons, can be applied to any stock contact form that allows the choice of multiple addressees.

    Quote Originally Posted by thetestingsite View Post
    If you have PHP installed on your server, you could use the code listed here:

    http://www.dynamicdrive.com/forums/s...75&postcount=3
    The original code is dreadful. There's no fallback should the request object fail to be created, and the PHP code poses a security risk. I can't open your archive in either Gzip (MingW) or 7-Zip so I can't confirm whether the same applies.

    Regardless of the quality of implementation, I don't see the point in involving "AJAX" at all. It just seems another one of those cases where one can say "I've used AJAX", rather than there being any real benefit.
    Mike

  4. #4
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    I should have been more specific in what I meant. The only thing that I was referring to was the use of the PHP code itself, then use any normal form (or that one if the OP wants). You do have a good point though:

    I don't see the point in involving "AJAX" at all. It just seems another one of those cases where one can say "I've used AJAX", rather than there being any real benefit.
    I simply pointed the OP to that one script because that was a working one that has simple "out-of-the-box" installation, as compared to some others that aren't as easy to implement. Anyways, I have editted my previous post to actually say only to use the PHP aspect of it, rather than the AJAX part.
    "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
    TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design

  5. #5
    Join Date
    May 2007
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanks guys will give this a go

  6. #6
    Join Date
    Dec 2004
    Location
    UK
    Posts
    2,358
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by thetestingsite View Post
    Anyways, I have editted my previous post to actually say only to use the PHP aspect of it, rather than the AJAX part.
    But that aspect of it poses a security risk, as I previously wrote. It performs no validation allowing a malicious user to use the script to send spam to anyone they like.

    Rolling ones own mail script is a risky venture - I wouldn't be very happy doing it myself. It's better to use a well-known third party script or, even better, remotely-hosted code. With the former, one can hope that it's been well-tested, but blame is still likely to fall on you, the developer, if a vulnerability is found and exploited (unless the original author assumes liability, which is unlikely). With the latter, if anything goes wrong the fault should lie with the provider.
    Last edited by mwinter; 05-12-2007 at 05:20 PM. Reason: Typos
    Mike

  7. #7
    Join Date
    May 2007
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    it doesnt work properly. I pasted the html coding into my contact.html file and it made the whole site squashed up in the middle.

    any idea's why?

  8. #8
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    It's possibly due to some css styling issue. Anyways, you could go keep your html form as long as you use the following names (for this script at least): to, subject, body, from. Other than that, you may have to customize the PHP for it to work with your form.

    Hope this helps
    "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
    TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design

  9. #9
    Join Date
    May 2007
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    So if i keep the php script you gave me above I can edit that to work with any html form?

    Im after something like this

    Code:
    <form method="POST" target="_self" action="formmail.php">
      <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="500" id="AutoNumber1" height="282">
        <tr>
          <td style="border-bottom: 1px solid #E1E1E1; padding-left: 10; padding-right: 10; padding-top: 2; padding-bottom: 2" width="111" height="25">
          <b><font size="2" color="#666666" face="Arial">Name:</font></b></td>
          <td style="border-bottom: 1px solid #E1E1E1; padding-left: 10; padding-right: 10; padding-top: 2; padding-bottom: 2" width="349" height="25">
          <input type="text" name="s1" size="20" style="font-family: Arial; font-size: 8pt; color: #333333" tabindex="1"></td>
        </tr>
        <tr>
          <td style="border-bottom: 1px solid #E1E1E1; padding-left: 10; padding-right: 10; padding-top: 2; padding-bottom: 2" width="111" height="25">
          <b><font size="2" color="#666666" face="Arial">Company:</font></b></td>
          <td style="border-bottom: 1px solid #E1E1E1; padding-left: 10; padding-right: 10; padding-top: 2; padding-bottom: 2" width="349" height="25">
          <input type="text" name="s2" size="20" style="font-family: Arial; font-size: 8pt; color: #333333" tabindex="2"></td>
        </tr>
        <tr>
          <td style="border-bottom: 1px solid #E1E1E1; padding-left: 10; padding-right: 10; padding-top: 2; padding-bottom: 2" width="111" height="25">
          <b><font size="2" color="#666666" face="Arial">E-mail Address:</font></b></td>
          <td style="border-bottom: 1px solid #E1E1E1; padding-left: 10; padding-right: 10; padding-top: 2; padding-bottom: 2" width="349" height="25">
          <input type="text" name="s3" size="20" style="font-family: Arial; font-size: 8pt; color: #333333" tabindex="3"></td>
        </tr>
        <tr>
          <td style="border-bottom: 1px solid #E1E1E1; padding-left: 10; padding-right: 10; padding-top: 2; padding-bottom: 2" width="111" height="25">
          <b><font size="2" color="#666666" face="Arial">Subject:</font></b></td>
          <td style="border-bottom: 1px solid #E1E1E1; padding-left: 10; padding-right: 10; padding-top: 2; padding-bottom: 2" width="349" height="25">
          <input type="text" name="s4" size="20" style="font-family: Arial; font-size: 8pt; color: #333333" tabindex="4"></td>
        </tr>
        <tr>
          <td style="border-bottom: 1px solid #E1E1E1; padding-left: 10; padding-right: 10; padding-top: 2; padding-bottom: 2" width="111" height="25">
          <b><font size="2" color="#666666" face="Arial">Website Rating:</font></b></td>
          <td style="border-bottom: 1px solid #E1E1E1; padding-left: 10; padding-right: 10; padding-top: 2; padding-bottom: 2" width="349" height="25">
          <select size="1" name="s5" style="font-size: 8pt; color: #333333; font-family: Arial" tabindex="5">
          <option>-Choose-</option>
          <option>1 (worst)</option>
          <option>2</option>
          <option>3</option>
          <option>4</option>
          <option>5 (Best)</option>
          </select></td>
        </tr>
        <tr>
          <td style="border-bottom: 1px solid #E1E1E1; padding-left: 10; padding-right: 10; padding-top: 2; padding-bottom: 2" width="111" valign="top" height="25">
          <b><font size="2" color="#666666" face="Arial">Referral:</font></b></td>
          <td style="border-bottom: 1px solid #E1E1E1; padding-left: 10; padding-right: 10; padding-top: 2; padding-bottom: 2" width="349" height="25">
          <input type="text" name="s6" size="20" style="font-family: Arial; font-size: 8pt; color: #333333" tabindex="6"></td>
        </tr>
        <tr>
          <td style="padding-left: 10; padding-right: 10; padding-top: 2; padding-bottom: 2" width="111" height="23">&nbsp;</td>
          <td style="padding-left: 10; padding-right: 10; padding-top: 2; padding-bottom: 2" width="349" height="23">&nbsp;</td>
        </tr>
        <tr>
          <td style="padding-left: 10; padding-right: 10; padding-top: 2; padding-bottom: 2" width="111" height="23">
          <b><font size="2" color="#666666" face="Arial">Message:</font></b></td>
          <td style="padding-left: 10; padding-right: 10; padding-top: 2; padding-bottom: 2" width="349" height="23">&nbsp;</td>
        </tr>
        <tr>
          <td style="border-bottom: 1px solid #E1E1E1; padding-left: 10; padding-right: 10; padding-top: 2; padding-bottom: 2" colspan="2" width="480" height="36">
          <textarea rows="11" name="s7" cols="87" style="font-size: 8pt; color: #333333; font-family: Arial" tabindex="7"></textarea></td>
        </tr>
      </table>
      <p><font face="Arial" style="font-size: 8pt">&nbsp;&nbsp;
      <input type="submit" value="Send Message" name="send" style="font-family: Arial; font-size: 8pt; color: #333333">
      <input type="reset" value="Reset Form" name="reset" style="font-family: Arial; font-size: 8pt; color: #333333"></font></p>
    </form>
    <div align="left">
      <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber2">
        <tr>
    How would I edit the php script to work with that? or is there a way I can do it without the php script?

  10. #10
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Whoa!

    Use CSS!

    About 90&#37; of the above code can be deleted, placed in the CSS at the top of your page (or an external .css file), then just use the class attribute to set it, rather than having several lines of formatting per word, as it is now.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

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
  •