this is link to code http://jsbin.com/ixupuk/4/edit
when my form is loaded into browser OR refreshed, all fields are auto-submitted to mysql database..
i included at the bottom, an if(isset) statement that i couldnt get to work.
thanx
amkaos 0 Light Poster
Recommended Answers
Jump to Postwhen my form is loaded into browser OR refreshed, all fields are auto-submitted to mysql database..
I am not sure but I never seen data submited to the database by refreshing the browsers.
Maybe using a cookie? Not sure.
You also need another query to update the data …
Jump to PostSuch things happens in self submitting page.
I used cookies to solve this kind of problem.
for example when user clicks save before submitting set one cookie say "saveinfo" to 1 , using javascript,Now along with isset using php $_COOKIE['saveinfo'] ==1,
in the end of page using javascript again …
Jump to PostNever use
if(isset($_POST))
as it's always set, even if no form is sent. It will be empty in that case, but still set. You could check to see if a submit button is set or check via!empty
.
Jump to PostI would normally use
if(isset($_POST['submit'])){
'the rest of your code'}
so the form is only submitted if the submit button is clicked, no matter how many times you refresh the page.
Jump to Poston refresh post data will remain same and even not empty, because on refresh same data will be resubmitted,
One solution is to use cookie.
See my previous reply to this thread
All 23 Replies
amkaos 0 Light Poster

LastMitch
amkaos 0 Light Poster

LastMitch
amkaos 0 Light Poster

LastMitch

LastMitch
amkaos 0 Light Poster

LastMitch
amkaos 0 Light Poster

LastMitch
amkaos 0 Light Poster

LastMitch
amkaos 0 Light Poster

LastMitch
amkaos 0 Light Poster
urtrivedi 276 Nearly a Posting Virtuoso

diafol
amkaos 0 Light Poster
TonyG_cyprus 36 Newbie Poster
urtrivedi 276 Nearly a Posting Virtuoso
amkaos 0 Light Poster
amkaos 0 Light Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.