0

I have a form built that currently sends info to a DB and allows me to email the person right after submission. Unfortunately, it only refreshes and clears the values of the page, I would like it to take them to a thank you page. The <form action="" is being used to POST it's data, is there a way I can post said data while still linking to a new page?

Code split up for readability

    <form id="hsForm_99a6d115-5e68-4355-a7d0-529207feb0b3_8417" class="hs-form
        stacked hs-custom-form" accept-charset="UTF-8"
        action="https://forms.hubspot.com/uploads/form/v2/341117/99a6d115-5e68-4355-a7d0-529207feb0b3" 
        enctype="multipart/form-data" method="POST" novalidate="novalidate">
<!-- Some form stuff...-->

<div class="form-actions form-wrapper" id="edit-actions">
<div class="hs_submit">
<div class="hs-field-desc" style="display: none;"></div>
<div class="actions"><input class="hs-button primary large" type="submit" value="Submit"></div>
</div>
</div>

</form>
knocked loose
  • 3,142
  • 2
  • 25
  • 46
  • Send the form request (submit to) to another page, do the db processing on that 2nd page and then write the redirection logic at the end of the 2nd page. See if that helps. – Maximus2012 Apr 14 '15 at 14:02
  • @Maximus2012, so I would need some thing like this? on the first page `action="https://www,google.com"` then on the second page `action="https://forms.hubspot.com/uploads/form/v2/341117/99a6d115-5e68-4355-a7d0-529207feb0b3" ` – knocked loose Apr 14 '15 at 14:04
  • No. you need only 1 action on the first page. You don't need action on 2nd page. Your first page's action would be the link to the 2nd page. – Maximus2012 Apr 14 '15 at 14:06
  • Is there a way to run 2 actions on the same form? such as update and link to google? for example.. – knocked loose Apr 14 '15 at 14:12
  • I think that should be possible. You will have to break the form display and form processing code into 2 parts. http://stackoverflow.com/questions/7381897/submit-form-to-self – Maximus2012 Apr 14 '15 at 14:15

2 Answers2

1

You can do this by sending header information back to the client after you have validated the user data. Keep in mind that the header informations have to be sent before any other output.

header('Location: myThankYouPage.php');

http://php.net/manual/de/function.header.php

whatTheFox
  • 118
  • 1
  • 8
0

In "action" file after processing data use header function to redirect user to new page