SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    SitePoint Zealot
    Join Date
    Oct 2008
    Posts
    140
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)

    Question html email form to php email form

    Hi

    I am in the middle of converting a site from html to php. Everything has gone great, except the forms. :-)

    Right now I have html forms that send an email (mail cgi) and redirects the user. I would like to use php to send and email (mail cgi) and redirect the use to a thank you page.

    Is there a way to clear the information that was put in the form before redirecting the use the a thank you page?

    Thanks
    Michelle

  2. #2
    From Italy with love silver trophybronze trophy
    guido2004's Avatar
    Join Date
    Sep 2004
    Posts
    9,495
    Mentioned
    161 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by techmichelle View Post
    Is there a way to clear the information that was put in the form before redirecting the use the a thank you page?
    What do you mean by clearing?

  3. #3
    SitePoint Zealot
    Join Date
    Oct 2008
    Posts
    140
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    form redirect <input type=hidden name="redirect" value="ThankYou php">

    only currently when you submit it redirects to ThankYou php?subject=xxxx

    and I do not want a subject.
    Thanks

  4. #4
    From Italy with love silver trophybronze trophy
    guido2004's Avatar
    Join Date
    Sep 2004
    Posts
    9,495
    Mentioned
    161 Post(s)
    Tagged
    4 Thread(s)
    This hidden field doesn't do any redirect. There has to be a script that handles the form after submitting it, and that takes the value from the hidden field and handles the redirect.

  5. #5
    SitePoint Zealot
    Join Date
    Oct 2008
    Posts
    140
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    Do you know of a sample php email form that emails the information then forwards to another page without sending the information? I have seen samples but non that use mail cgi and non that clears the information.

  6. #6
    SitePoint Member
    Join Date
    Jul 2008
    Posts
    13
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I have the same situation and am converting from CFM to PHP. Did you ever find anything?

  7. #7
    SitePoint Zealot
    Join Date
    Oct 2008
    Posts
    140
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    Nope, didn't find an example.

    Michelle

  8. #8
    SitePoint Wizard bronze trophy
    Join Date
    Jul 2008
    Posts
    5,757
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Your cgi script is responsible for redirecting and including the subject into the url query string. Ideally, you should modify this script to not do that. Or, just use php to send the email and forget about the cgi script.

    Otherwise, you need to either:
    Have the form submit to php. php then uses curl to POST the form data to the cgi script. Then php redirects the user.

    or

    Have the form post to cgi, but redirect to thankyou.php. php then redirects the user once more(to the thank you page). eg
    PHP Code:
    <?php
    // thankyou.php
    header('Location: http://example.com/foo/thankyou.html');
    The user may see the stuff in the query string for a split second before php redirects, so it may get stored in the browser history.


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
  •