How could I do this?

Discussion in 'PHP' started by Mia, Oct 18, 2007.

  1. #1
    Hello, I am creating a simple form requesting name, phone, email and comments. When someone hits submit, I want to have the contents emailed to me, with the output in a tab-delimited file/style so it can be imported into excel. I also want to have a thank you response sent out to the person that submitted to the form?

    Any ideas on how to do this.. All I have right now is the form page as follows:

    To be notified of future events and announcements, <br>
      please fill out the following form and click submit. &nbsp;</span></p>
    <p class=MsoNormal align=center style='text-align:center'>&nbsp;</p>
    <table width="431" border="0" align="center">
      <tr>
        <td width="309"><form name="form1" method="post" action="">
          <label>First Name:
            <input name="firstname" type="text" id="firstname">
          </label>
        </form></td>
        </tr>
      <tr>
        <td><form name="form1" method="post" action="">
          <label>Last Name:
            <input name="lastname" type="text" id="lastname">
          </label>
        </form></td>
        </tr>
      <tr>
        <td><form name="form1" method="post" action="">
          <label>eMail:
          <input name="email" type="text" id="email">
          </label>
        </form></td>
        </tr>
      <tr>
        <td><form name="form1" method="post" action="">
          <label>Phone:
          <input name="phone" type="text" id="phone">
          </label>
        </form></td>
        </tr>
      
      <tr>
        <td><form name="form2" method="post" action="">
          <label>Comments:
            <textarea name="comments" id="comments"></textarea>
            </label>
        </form>
        </td>
      </tr>
      
      <tr>
        <td><form name="form6" method="post" action="">
          <label>
          <input type="submit" name="Submit" value="Submit">
          </label>
        </form></td>
        </tr>
    </table>
    Code (markup):
     
    Mia, Oct 18, 2007 IP
  2. theOtherOne

    theOtherOne Well-Known Member

    Messages:
    112
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    108
    #2
    Using the mail()-function in PHP you can send e-mails to both you and your customer as soon as somebody hits submit.
    www.php.net/mail

    To create a Tab within your mail text you use the following: \t
    So a line like "mail\texample@example.com" will output:
    
    mail	example@example.com
    
    Code (markup):
     
    theOtherOne, Oct 18, 2007 IP
  3. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #3
    No offense, but you charge $50/hour for PHP programming and don't know how to do this?

    What you're asking for is very basic, and I honestly don't know how you can charge $50 for this...

    Or... did you sell this place and it's referring to someone else? lol... I'm confused.
     
    nico_swd, Oct 18, 2007 IP
  4. Mia

    Mia R.I.P. STEVE JOBS

    Messages:
    23,694
    Likes Received:
    1,167
    Best Answers:
    0
    Trophy Points:
    440
    #4
    My company offers this service. I am doing this on a personal basis... Everyone is pretty busy around here at the moment, so I'm not inclined to take anyone away from more important work for my own personal project.

    There's really no need to be a dick... ;)
     
    Mia, Oct 18, 2007 IP
  5. Barti1987

    Barti1987 Well-Known Member

    Messages:
    2,703
    Likes Received:
    115
    Best Answers:
    0
    Trophy Points:
    185
    #5
    There is no need to be rude. He asked a simple question, no need to disrespect him.

    Anyway, here is a script that I wrote which does what you need without the file output:

    http://www.free-php-scripts.net/P/Contact_Form

    Peace,
     
    Barti1987, Oct 18, 2007 IP
    nico_swd likes this.
  6. Mia

    Mia R.I.P. STEVE JOBS

    Messages:
    23,694
    Likes Received:
    1,167
    Best Answers:
    0
    Trophy Points:
    440
    #6
    I agree, there was no reason for him to be rude.. Anyway, thank you for the example.. I already made one... Just doing a favor for a friend that was not at all work related..

    ;)
     
    Mia, Oct 18, 2007 IP