Note that there are some explanatory texts on larger screens.

plurals
  1. PORefresh page php
    text
    copied!<p>how would i go about refreshing a page after i have submitted a form and done some php stuff with it. Heres my form and the php so far.</p> <pre><code>&lt;form class="removeform"action='peteadd.php'method='post' enctype='multipart/form- data' name='image_remove_form' &gt; &lt;?php include '../inc/connect.php'; $q = "SELECT * FROM gallerythumbs WHERE gallery = 1"; if($r = mysql_query($q)){ while($row=mysql_fetch_array($r)){ echo "&lt;div class='thumb'&gt;", "&lt;input type='checkbox' name='remove[{$row['id']}]'&gt;", "&lt;label for='Remove'&gt;&lt;span class='text'&gt;Remove&lt;/span&gt;&lt;/label&gt;", "&lt;br /&gt;", "&lt;img class='thumbnail' src='{$row['filename']}' alt='{$row['description']}' /&gt;", "&lt;/div&gt;"; } } else{ echo mysql_error(); } ?&gt; &lt;input type='submit' name='submit' value='Remove' /&gt; &lt;/form&gt; &lt;/div&gt; &lt;?php include '../inc/connect.php'; //if delete was checked, delete entries from both tables if(isset($_POST['remove'])){ $chk = (array) $_POST['remove']; $p = implode(',',array_keys($chk)); $t = mysql_query("SELECT * FROM galleryimages WHERE id IN ($p)"); $r = mysql_query("SELECT * FROM gallerythumbs WHERE id IN ($p)"); $url=mysql_fetch_array($t); $image=$url['filename']; $url2=mysql_fetch_array($r); $image2=$url2['filename']; if ($t){ unlink($image); unlink($image2); $q = mysql_query("DELETE FROM galleryimages WHERE id IN ($p)"); $s = mysql_query("DELETE FROM gallerythumbs WHERE id IN ($p)"); } else{ echo "&lt;span class='text'&gt; There has been a problem, go back and try again. &lt;br /&gt; &lt;a href='peteadd.php'&gt;Back&lt;/a&gt; &lt;/span&gt;"; } } else{ echo "&lt;span class='title'&gt; There are no images in the gallery &lt;br /&gt; &lt;a href='peteadd.php'&gt;Add Images&lt;/a&gt; &lt;/span&gt;"; } ?&gt; </code></pre> <p>This for display some thumbnails that are saved in mysql with a remove checkbox above them. When I check them then submit the form the are deleted from the direcotries and the mysql tables ok, but how can I refresh the page so the deletion is obvious?</p> <p>Thanks for looking</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload