what is techically correct when submitting form

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
stribor
Forum Newbie
Posts: 12
Joined: Fri Apr 01, 2011 10:48 pm

what is techically correct when submitting form

Post 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
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Re: what is techically correct when submitting form

Post 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.
Post Reply