Let's say I have such an HTML form to collect an email from a website visitor:
<form name="input" action="handle_email.php" method="post"> Email: <input type="text" name="email" /> <input type="submit" value="Newsletter" /> </form>
Now that the submit button is pressed, I can get the value of the email field in handle_email.php using $ _POST ["email"]. But I will say that I would like to use the value of inputting email text elsewhere. Is it possible to get the email value “outside” the form processing?
UPDATE: Thanks to everyone for their quick answers. What I'm trying to do is get a mailbox to perform a double duty. For example, I renamed the submit button to "Newsletter" in the code above. When this button is clicked, the handle_email.php script will simply register the user for newsletters. However, I also have a “Registration” link on the same page, which redirects the visitor to the registration form, where they can enter a lot of other information if they want. Now, if a user accidentally entered data in an email text field, I would like to send it to the registration page so that the field is pre-filled. For example:
<a href="http://mywebsite.com/register?user_email="[how can I put the email here?]"/>Register</a>
I apologize for not being clear enough in my original post.
html input forms
Kevin
source share