I’d like to take the data entered into a form and store it in a MySQL table using PHP, then pass to a target page using POST.
For instance say the standard version of the form would pass to the target.html page:
<form name="input" action="target.html" method="POST">
First name: <input type="text" name="fname" /><br />
Last name: <input type="text" name="lname" /><br />
Phone: <input type="text" name="lname" /><br />
<input type="submit" value="Submit" />
What approaches could one take to accomplish the storing of the form data into MySQL, and then passing the data via POST to the target page?
You cannot submit a form to one page and access the POST data on another You would need to submit the form to your target page and do the database insert from that page.
The other option is to submit to the same page that the form is located on, insert the data into the database, set up a session and redirect the user to the target page.
Not… entirely true.
You can have the form on page A (local) be processed by page B (local); during page B’s execution, it can cURL the data out to page C (remote).
It wont fool the URL bar, but the data will get passed.
Sure, you could cURL the data to page C but is that really necessary when you can just submit the form to page C and handle everything from that page? Seems like an unnecessary step to me.
Depends on if you’re in control of Page C or not.