cruxaders Posted April 6, 2011 Share Posted April 6, 2011 i got a submit button... if user click the submit button iwant to page will auto referesh... can someone teach me Quote Link to comment https://forums.phpfreaks.com/topic/232865-how-to-make-button-auto-refresh-page/ Share on other sites More sharing options...
KevinM1 Posted April 6, 2011 Share Posted April 6, 2011 If you're submitting to a form, and the form's action is blank, the page will refresh automatically. Quote Link to comment https://forums.phpfreaks.com/topic/232865-how-to-make-button-auto-refresh-page/#findComment-1197718 Share on other sites More sharing options...
cruxaders Posted April 6, 2011 Author Share Posted April 6, 2011 hirs the code...my proble is when i upload a image yes its upload but the problem is the previous image that he got...that still the image i see after i click submit..then i press f5 to see the updated image i uploaded.... what i want is after i press submit button i want the previous image will be automatic replaced by current/updated images no need to press F5 $id = "sir"; $sql = "SELECT * FROM `users` WHERE `username` = '".$id."'"; $res = mysql_query($sql) or die (mysql_error()); $row = mysql_fetch_assoc($res); $location = $row ['imagelocation']; echo "avatar <img src=\"$location\" width=\"100\" height=\"100\">"; echo "<form action=\"\" name=\"form1\" enctype=\"multipart/form-data\" method=\"post\" >"; echo "<input type=\"file\" name=\"image\" />"; echo "<input type=\"submit\" name=\"submit\" value=\"submit\" action =\"\">"; echo "</form>"; if($_POST['submit']) { $name = $_FILES['image']['name']; $tmp_name = $_FILES['image']['tmp_name']; $location = "avatar/".$name; move_uploaded_file($tmp_name,$location); $sql = mysql_query("UPDATE `users` SET `imagelocation` = '".$location."' WHERE `username` = '".$id."'") or die (mysql_error()); Quote Link to comment https://forums.phpfreaks.com/topic/232865-how-to-make-button-auto-refresh-page/#findComment-1197723 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.