You would think the answer would be all over the Internet and easy to find, but it’s not. I have searched many times, and in all the multitude of search results I have still never found an adequate usable answer. The MOST you ever find is someone saying how easy it is with PHP, but they don’t tell you how, even when the person they are answering asks them (odd). You can be that one in a billion person who finally answers it for real and helps someone out.
I have a simple HTML form with data fields first_name, last_name, email, phone, country, a few hidden inputs, and a single submit button, like so:
(Please note: the method is GET, not Post.)
<form action="https://MyDomainOnMyServer.com/MyPHPScript.php”>
<input type="text" name="first_name" value="" />
<input type="text" name="last_name" value="" />
<input type="text" name="email" value="" />
<input type="text" name="phone" value="" />
<input type="hidden" name="type" value="type123">
<input type="hidden" name="project" value="new123">
<select required name="country">
<option value="">Choose your country</option>
<option value="US">United States</option>
<option value="CA">Canada</option>
<option value="GB">United Kingdom</option>
<option value="Many More">Many More Countries</option>
</select>
<input type="submit" value="Submit Form" />
</form>
NOTE: Originally, the form action would have been:
action="https://TheirExampleDomainOnTheirRemoteServer.com/TheirRemotePHPScript.php" name="form1234"
Upon clicking the single submit button only, what I need to have happen is this:
-
Send me an email to [email protected] containing all the form submission data
-
Place the form submission data into a MySQL database having the corresponding data fields
-
Send the form submission contents including the hidden input values to
"https://TheirExampleDomainOnTheirRemoteServer.com/TheirRemotePHPScript.php" name="form1234"
AS IF that had remained set as the original form action to begin with
So basically what I’m trying to obtain is the cleanest possible PHP script that will do those three things, which is essentially what others have asked for over the years in search results I have found, but no one has ever provided it in a clear instance that works. If I can just see such a script, I should be able to see how it works and then do what I need. Thanks.