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!
I'm using 'if' to check if a form has been submitted and if it has Insert stuff into the dB..... but if the page is reloaded it Inserts again!
I can't seem to drop the $Submit at all.
I've tried 'unset' but no joy, can anyone point me in the right direction?
lemme guess, your form and php processing is all in the same page. not a bad thing.
and the form is POSTing to itself and you if statement is catching the fact that it has been submitted. also, not a bad thing.
but then you try to refresh the page right after you submitted to it. this is where your problem lies. your browser is RE-submiting the form data and as a result $Submit is still going to be set.
hope that helps
don't use the refresh button to re-request the page, rather click a link that will re-call this page. the problem does not lie in you php script, at least not inherintly, but rather the way that browsers handle posted forms in combination with the refresh button.
Thanks
I'd still like to find a way of turning this off though!!
I haven't tried it yet but there's going to be several pages with the same script on, will they auto-insert too or is it once again a refresh issue?
whenever a php page displays a form and then processes the results of that form, you will always have this refresh problem. i can't think of anycheck that you could do that would fix this problem.