php value problem

Reply

Join Date: Sep 2006
Posts: 22
Reputation: komrad is an unknown quantity at this point 
Solved Threads: 1
komrad's Avatar
komrad komrad is offline Offline
Newbie Poster

php value problem

 
0
  #1
Oct 13th, 2008
Hello all,

I'm a learning php this year but i encounters some problems.

One of them is about php value. The problem is how do i do to prevent a php file from resending the same values into the database whenever the page is refreshed?

Anyone help?


Thanks,

Asep
Reply With Quote Quick reply to this message  
Join Date: Jun 2008
Posts: 849
Reputation: R0bb0b is on a distinguished road 
Solved Threads: 67
R0bb0b's Avatar
R0bb0b R0bb0b is offline Offline
Practically a Posting Shark

Re: php value problem

 
0
  #2
Oct 13th, 2008
The only way that I know of doing this is redirecting after the post. For such a reason I usually process my posts on a separate file and then redirect back.
“Be who you are and say what you feel because those who mind don't matter and those who matter don't mind.” - Dr. Seuss

-- The documentation is inevitable, you may get away with it for a little while but eventually you too will have to do the deed.
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 1,076
Reputation: Shanti Chepuru is on a distinguished road 
Solved Threads: 98
Shanti Chepuru's Avatar
Shanti Chepuru Shanti Chepuru is offline Offline
Veteran Poster

Re: php value problem

 
0
  #3
Oct 14th, 2008
or check for main fields of that post form...then i can be prevented...
for example...
  1. $seq="select count(*) as cnt from tablename where username='".$_POST['username']."'";
  2. sres=mysql_query($seq);
  3. $srow=mysql_fetch_assoc($sres);
  4.  
  5. if($srow['cnt']>0) {
  6.  
  7. $errmsg="User with this Username already existed.";
  8.  
  9. } else
  10. {
  11. //do your insert operations..
  12. }
and for empty fields doing client side validation is better...
Last edited by Shanti Chepuru; Oct 14th, 2008 at 1:14 am.
Be intelligent, But Don't try to cheat.. Be innocent But Don't get cheated..
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:




Views: 467 | Replies: 2
Thread Tools Search this Thread



Tag cloud for PHP
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC