943,801 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 646
  • PHP RSS
Oct 13th, 2008
0

php value problem

Expand Post »
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
Similar Threads
Reputation Points: 7
Solved Threads: 2
Light Poster
komrad is offline Offline
39 posts
since Sep 2006
Oct 13th, 2008
0

Re: php value problem

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.
Reputation Points: 358
Solved Threads: 89
Posting Shark
R0bb0b is offline Offline
986 posts
since Jun 2008
Oct 14th, 2008
0

Re: php value problem

or check for main fields of that post form...then i can be prevented...
for example...
php Syntax (Toggle Plain Text)
  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 C; Oct 14th, 2008 at 1:14 am.
Reputation Points: 137
Solved Threads: 162
Posting Virtuoso
Shanti C is offline Offline
1,641 posts
since Jul 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: Checkboxes
Next Thread in PHP Forum Timeline: Functions to validate e-mail, name and phone number





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC