Friday, March 30, 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

plot explanation - Why did Peaches' mom hang on the tree? - Movies & TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...