Friday, 30 March 2018

php - how to redirect url after submitting a form?



It seems to be a simple but still it is difficult for me to achieve.
Let`s make a small example to clarify the situation:
There are two files: Form.PHP and Action.PHP



Form.PHP has one Input field with name = "ID"
and button SUBMIT




Action.PHP has a script of inserting data in MySQL
and in the end next line:



header("location:Form.PHP");


So after the submitting the form, I come back to Form.PHP...
This is easy...




Now, I want to achieve - after the submitting the form redirection to
Form.PHP?ID=$_POST['ID']



So please help me to modify
header("location:Form.PHP"); to redirect to ?ID=$_POST['ID']


Answer



header("Location: Form.PHP?ID=".$_POST['ID']);

No comments:

Post a Comment

casting - Why wasn't Tobey Maguire in The Amazing Spider-Man? - Movies & TV

In the Spider-Man franchise, Tobey Maguire is an outstanding performer as a Spider-Man and also reprised his role in the sequels Spider-Man...