SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Member
    Join Date
    Feb 2012
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    collecting info from forms and emailing it to a user

    I am not that experienced with php and we created an energy calculator that computes savings. I would like to provide a button to the user to email the results to themselves or whoever else they would like to. I can't just email the link because the calculations reset so I need to collect the final data after the calculations. I am not sure how to do this but I have seen php contact forms that email data to a company's email address. Anyone know how to do this? Here is the page:
    http://www.litepanels.com/language/p...calculator.php

  2. #2
    SitePoint Enthusiast abdussamad's Avatar
    Join Date
    May 2006
    Posts
    30
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Just add an email field and a submit button next to it. When the data is submitted to the php script on the server it can arrange it in a nice email and send it out.

  3. #3
    SitePoint Member
    Join Date
    Feb 2012
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    not sure what you mean at all...like I said I am new to this. Our energy calculator page isn't using php besides serving up the header and footer. How will it collect the data from the other fields?

  4. #4
    SitePoint Enthusiast
    Join Date
    Dec 2011
    Posts
    27
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You are using javascript for the calculator, or so it seems.

    Could you use javascript to gather up the result of the calculations, including the fields, and send a http request?
    If you could do that, a php script can be called by a button sending said request, with the php script formatting and sending the mail.

    im not javascript-savvy, so someone else or yourself will have to figure out the JS part.

  5. #5
    SitePoint Member
    Join Date
    Feb 2012
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks but the javascript was from an application, so I didn't write it and I do not know how to write that. Is there any way to do it with php, like save the info to a database or some other idea?

  6. #6
    SitePoint Enthusiast
    Join Date
    Dec 2011
    Posts
    27
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    There is a way. But the javascript must be modified to accomodate for it. I do not know if there is a way for JS to connect to the DB, but i doubt it.

    To make the user input "readable" by php you must pass it onto a php script, either as a http request, or a "submit" button on the form.
    It's going to require modification of the JS or HTML to allow for submitting. there is no magic at work in php to catch this sadly, and if it were itd be a security hole...

    Figure out if you want to modify it or build it anew.

  7. #7
    SitePoint Enthusiast abdussamad's Avatar
    Join Date
    May 2006
    Posts
    30
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This is a help forum for PHP programmers. You are in the wrong place, frankly. If you don't know PHP please hire someone who does.


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
  •