Jay2391 Posted February 16, 2007 Share Posted February 16, 2007 is there a command that you can tell a page after you submit this refresh the page.... what is happening is that I Submit and my DB gets updated... and i stay on the same page wich i want .... but not until I hit Refresh or Go or Simply Submit again that the results how ...so is working but like a double click .... All I want is that when i Submit Stay on the same page and refresh to show the update... print "<h5><form action=\"user_profile.php?user_id=$user_name\" method=\"post\"><p>"; <input type=\"submit\" name=\"submit_away\" size=\"20\" value=\"Submit Scores\"/>"; if ( isset ($_POST['submit_away'])){ $problem = FALSE; if($vscr == $hvscr){ $problem = TRUE; print '<p>Not a valid Score</p>'; } if($vscr == 0 and $hvscr == 0){ $problem = TRUE; print '<p>One team must have a Score</p>'; } if (empty ($_POST['hvscore'])){ $problem = TRUE; print '<p>Please enter Home Team Score</p>'; } if (empty ($_POST['vscore'])){ $problem = TRUE; print '<p>Please enter Visiting Team Score</p>'; } if($problem == FALSE){ $change_vs = "UPDATE $table_vs SET hv_scr='$hvscr', v_scr=$vscr WHERE (vs_id=\"$vs_id2\")"; mysql_query($change_vs) or die ("Cannot Update Table". mysql_error()); } } Quote Link to comment Share on other sites More sharing options...
mbtaylor Posted February 16, 2007 Share Posted February 16, 2007 I usually send a header to the browser: header ("Location: ".$_SERVER['PHP_SELF'].""); PHP SELF is the page you are on, or put in another location if you want to change to a different page. Quote Link to comment Share on other sites More sharing options...
Jay2391 Posted February 16, 2007 Author Share Posted February 16, 2007 do I put this on the post area??? i get this Cannot modify header information - headers already sent by (output started at C:\XAMPP\xampp\htdocs\MDO\user_profile.php: in C:\XAMPP\xampp\htdocs\MDO\user_profile.php on line 376 Quote Link to comment Share on other sites More sharing options...
mbtaylor Posted February 16, 2007 Share Posted February 16, 2007 Erm... headers need to be right at the top of the page if you havent got output_buffering on. Personally I use output_buffering (in php.ini) if you turn that to On then you wont get that error. Otherwise you would need to put the header code before any outputted html code (someone correct me if im wrong there). Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.