2

how can i get the content of the input tag in php , as i search i have to put the input tags into form tag and then pass them to another page , is it possible to get the content in that page and do something like send them via email and then clear the input tags content ?!! these are the thing i found to pass the content :

<form action="recevie.php" method="post" >
  Name:
  <input type="text" name="fname" />
  Age:
  <input type="text" name="age" />
  <input type="submit" />
</form>
3
  • You mean, you need to get the form data in the same page without page refresh? Commented Apr 4, 2014 at 16:09
  • If you mean submit the form to the same page, you just need to remove that action form attribute. Do you mean so? Commented Apr 4, 2014 at 16:10
  • Put your entire code inside one file, preferably PHP on top of HTML, then use action="" including an isset conditional statement; or use Ajax. Commented Apr 4, 2014 at 16:20

2 Answers 2

1

You can submit the page into the same page that's you are in, but is not the best practice.

You Should Redirect the page Back to your form's page after you process the form, you can utilize header("Location: example.php"); to page back or to redirect where you want to.

Remember that header() must be called before any actual output is sent, either by normal HTML tags, blank lines in a file, or from PHP.

Sign up to request clarification or add additional context in comments.

Comments

1

If you need to access to your form data without manually submitting it, you'll have to use Javascript.

In Javascript then, you can send an Ajax request with this data if you need processing them on the PHP side.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.