Page 1 of 1
what is techically correct when submitting form
Posted: Tue Jan 17, 2012 11:28 am
by stribor
I have form on the page myForm.html.
Once I submit the form I would like to show this same form again. I am doing it like this...
Code: Select all
header("refresh:2;url=myFrom.html");
I am interested to know if this is correct way of doing it. Is there better way?
Thanks
Re: what is techically correct when submitting form
Posted: Tue Jan 17, 2012 12:52 pm
by califdon
So your form's action parameter calls the same php script, right? I'm not clear on what you are trying to do. What happens to the user's form data? Do you just want the user to keep submitting data, repeatedly? Can you explain what you want to do, and show us the form for your code and for what you are doing with the data?
Usually I wouldn't use the header() redirect in these circumstances. In fact, if you don't want the web page to change, it would probably be more appropriate to use an AJAX call to send the data to another php script to do whatever you want to do with it, leaving the page unchanged, except perhaps for blanking out the user's input, which you would do with Javascript. But without knowing why you are doing this, it's hard to say.