display thank you message in original form page

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • spaghetti
    New Member
    • Dec 2006
    • 5

    display thank you message in original form page

    Hi forum

    I'm totally new to php and mySQL so please excuse my ignorance. I've been trying to research this but because I'm not totally sure what I'm searching for I haven't yet found a solution.

    Essentially I have a form that posts data (name, number, recommended friend, recommended email). This data is then inserted into a table and a "Thank you for your recommendation" message is echoed. So far so good.

    But currently the message is displayed on the process page. What I would like is to display the thank you message in the original page, within the original form #div and perhaps display the data that was submitted as confirmation.

    I'd appreciate any guidance on how to go about this.

    Thanks in advance.
  • michaelb
    Recognized Expert Contributor
    • Nov 2006
    • 534

    #2
    This is not so much about PHP, what you asking looks more like a general question on web design.

    I think it boils down to the following:
    You still need to submit the input data to the backend, before you display the "thank you" note.
    (There is a way to avoid it, but IMHO this would be an inferior design)
    One way to stay in the current page and still submit the data is to use IFRAME.
    The question to ask is what it would give you that you would not get otherwise?
    With your current schema all you need is available to you and you can display the submitted data on the same page where you display the "thank you" message.
    This allows to keep your design consize and not to get into potential problems with different browsers when dealing with IFRAME, dynamic html and other things you may have to employ if you proceed with idea of staying on the same page.

    Comment

    • ronverdonk
      Recognized Expert Specialist
      • Jul 2006
      • 4259

      #3
      In other words: when you combine the 2 scripts (the form and the db update) into one page, you can extend the db update part with the thank you message. This setup also allows you to check any fields, the user has entered, for validity, and re-display the form when an error is encountered,
      A simple setup is:
      Code:
      if form=submitted
      do;
        check validity
        update database
        issue thank you message
        exit;
      if errors found
        display errors
      endDo;  
      re-)display form
      enter data
      submit form
      Ronald :cool:

      Comment

      • spaghetti
        New Member
        • Dec 2006
        • 5

        #4
        Thanks for your input - I think I've got a clearer picture now. I'll see if I can get this to work.

        I only thought it was possible because I have a 3rd party form that displays a message after the user updates their profile. But I couldn't work out how it was implemented and didn't trust myself not to break it!

        Thanks for your guidance.

        Comment

        Working...