kadence — 2011-10-16T23:17:21-04:00 — #1
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?
programthis — 2011-10-16T23:22:25-04:00 — #2
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.
starlion — 2011-10-17T08:36:25-04:00 — #3
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.
programthis — 2011-10-17T14:19:17-04:00 — #4
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.
starlion — 2011-10-18T09:28:46-04:00 — #5
Depends on if you're in control of Page C or not.