Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to reload the page using php, I am not to use anyother lan. header not working for me
    primarykey
    data
    text
    <p>Let me explain what i need to do, the img below is my page. it is connected to mysql on CentOs sever, also php is on centos. </p> <ul> <li>There is Which is restore and also Delete. </li> <li>All it suppose to do is to update a value on the database. </li> <li>When its updated its either changes to restore or delete. </li> <li>I did all that my problem is that i cant see it change right when i click it, i have to reload the page. </li> <li>Like for example if I click Delete (using get) it updates the database and it should change itself to Restore, i have a php code to make it change but i have to manully refresh the page. </li> <li>I have tried php Header, it works on Xampp but not here some reason. </li> </ul> <p>.</p> <pre><code>$page = $_SERVER['PHP_SELF']; $sec = "0.001"; header("Refresh: $sec; url=$page") </code></pre> <p>Also</p> <pre><code>header("Location: view.php"); </code></pre> <p><img src="https://i.stack.imgur.com/mggVH.png" alt="enter image description here"></p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;meta charset="UTF-8"&gt; &lt;?php include "library2.php"; include "delete.php"; printHeader(); // prints the logo ?&gt; &lt;title&gt; View &lt;/title&gt; &lt;link rel="stylesheet" type="text/css" media="screen" href="styles.css"&gt; &lt;nav&gt; &lt;ul&gt; &lt;li&gt; &lt;a href="add.php"&gt; Add &lt;/a&gt; &lt;/li&gt; &lt;li&gt; &lt;a href="view.php"&gt; View &lt;/a&gt; &lt;/li&gt; &lt;/ul&gt; &lt;/nav&gt; &lt;/head&gt; &lt;body&gt; &lt;?php $link = connectMysql(); $sql_query = "SELECT * from inventory;"; $result = runQuery($link, $sql_query); if($_GET){ deleteRestoreItem($_GET['DeleteRestore']); $page = $_SERVER['PHP_SELF']; $sec = "0.001"; header("Refresh: $sec; url=$page"); } ?&gt; &lt;div id ="view"&gt; &lt;/br&gt; &lt;/br&gt; &lt;/br&gt; &lt;table &gt; &lt;th&gt; ID &lt;/th&gt; &lt;th&gt; Item Name &lt;/th&gt; &lt;th&gt; Description &lt;/th&gt; &lt;th&gt; Supplier Code &lt;/th&gt; &lt;th&gt; Cost &lt;/th&gt; &lt;th&gt; Selling Price &lt;/th&gt; &lt;th&gt; Number On Hand &lt;/th&gt; &lt;th&gt; Reorder Point &lt;/th&gt; &lt;th&gt; Back Order &lt;/th&gt; &lt;th&gt; Delete/Restore &lt;/th&gt; &lt;?php while($row = mysqli_fetch_assoc($result)) { ?&gt; &lt;tr&gt; &lt;td&gt; &lt;?php print $row['id']; ?&gt; &lt;/td&gt; &lt;td&gt; &lt;?php print $row['itemName']; ?&gt; &lt;/td&gt; &lt;td&gt; &lt;?php print $row['description']; ?&gt; &lt;/td&gt; &lt;td&gt; &lt;?php print $row['supplierCode']; ?&gt; &lt;/td&gt; &lt;td&gt; &lt;?php print $row['cost']; ?&gt; &lt;/td&gt; &lt;td&gt; &lt;?php print $row['price']; ?&gt; &lt;/td&gt; &lt;td&gt; &lt;?php print $row['onHand']; ?&gt; &lt;/td&gt; &lt;td&gt; &lt;?php print $row['reorderPoint']; ?&gt; &lt;/td&gt; &lt;td&gt; &lt;?php print $row['backOrder']; ?&gt; &lt;/td&gt; &lt;td&gt; &lt;?php if($row['deleted']=="n") { ?&gt; &lt;a href="view.php?DeleteRestore=&lt;?php echo $row['id'];?&gt;"&gt;Delete&lt;/a&gt; &lt;?php } if($row['deleted']=="y") { ?&gt; &lt;a href="view.php?DeleteRestore=&lt;?php echo $row['id'];?&gt;"&gt;&lt;/a&gt;&lt;?php } ?&gt; &lt;/td&gt; &lt;/tr&gt; &lt;?php } ?&gt; &lt;/table&gt; &lt;/br&gt; &lt;/div&gt; &lt;/body&gt; &lt;footer&gt; &lt;?php printFooter() ?&gt; &lt;/footer&gt; &lt;/html&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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