Updating required 2 Clicks of the same button

Reply

Join Date: Dec 2007
Posts: 608
Reputation: OmniX is an unknown quantity at this point 
Solved Threads: 8
OmniX's Avatar
OmniX OmniX is offline Offline
Practically a Master Poster

Updating required 2 Clicks of the same button

 
0
  #1
May 16th, 2008
Problem is:
I click my submit button it updates the database but not the website content, I click the submit button again and it updates the website content this time.

This problem always pops up, and its due to incorrect structure of code in most parts

I cant seem to remember what structure I should have my code set out to (updates, selects, etc and in which order) - as it seems complex yet correct.

So anyone lead me in the right direction? Thanks

PS: I use the below code to refresh the page:
  1. header('refresh: 0; url=test.php');
Reply With Quote Quick reply to this message  
Join Date: Jan 2008
Posts: 79
Reputation: rudevils is an unknown quantity at this point 
Solved Threads: 9
rudevils rudevils is offline Offline
Junior Poster in Training

Re: Updating required 2 Clicks of the same button

 
0
  #2
May 17th, 2008
try it like this

  1. if($submit){
  2. $query = "your update query";
  3. $result = mysql_query($query);
  4. if($result){
  5. header("Location: yourpage.php");
  6. }
  7. }

after u submit the button, your current page will redirect automatically to yourpage.php
If love is blind, why there's a bikini ??

Post your article at Bali Side Notes share your knowledge
Reply With Quote Quick reply to this message  
Join Date: Dec 2007
Posts: 608
Reputation: OmniX is an unknown quantity at this point 
Solved Threads: 8
OmniX's Avatar
OmniX OmniX is offline Offline
Practically a Master Poster

Re: Updating required 2 Clicks of the same button

 
0
  #3
May 17th, 2008
Well I have like 3-4 queries done this one submit button so you want me to try doing that for the last one?

But all queries work so the page should be refreshed either way?

Also I have tried Location, and the same thing happens but worse.
Reply With Quote Quick reply to this message  
Join Date: Dec 2007
Posts: 608
Reputation: OmniX is an unknown quantity at this point 
Solved Threads: 8
OmniX's Avatar
OmniX OmniX is offline Offline
Practically a Master Poster

Re: Updating required 2 Clicks of the same button

 
0
  #4
May 17th, 2008
Also for what it matters at the moment I have cut the code and inserted into two submit buttons and works fine.
Reply With Quote Quick reply to this message  
Reply

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



Other Threads in the PHP Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC