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:

header('refresh: 0; url=test.php');

Recommended Answers

All 3 Replies

try it like this

if($submit){
   $query = "your update query";
   $result = mysql_query($query);
   if($result){
       header("Location: yourpage.php");
   }
}

after u submit the button, your current page will redirect automatically to yourpage.php

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.

Also for what it matters at the moment I have cut the code and inserted into two submit buttons and works fine.

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.