Page Reload


Posted on 16th Feb 2014 07:03 pm by admin

I am having issues getting a page to reload after I submit data to a database. This form should input data to a DB and then I want it to reload and list what is in database. I have gotten it to reload and list the data but it always lists everything through to the second to last entry. The most current entry does not get listed. I must refresh the page to get it to list.

main form
Code: [Select]<?php
include 'refresh.php'; //should refresh the page
include 'dbc.php'; //database connection
include 'list_categories.php'; //lists all the categories from the database
echo "<br />";
?>
<form name="form1" method="post" action="add_category.php">
Add Category : <input name="category" type="text" id="category"><input type="submit" name="submit" value="Submit"></p>
</form>

<form name="form2" method="post" action="delete_category.php">
Delete: <?php include 'get_categories.php'; ?><input type="submit" name="submit" value="Submit">
</form>



<a href="http://budget.themarkhart.com/delete_all_categories.php">Delete All</a>



<a href="menu.php">Menu</a>

refresh.php
Code: [Select]<?php
$page = $_SERVER['PHP_SELF'];
header("Refresh: url=$page");
?>

list.php
Code: [Select]<?php

include 'dbc.php';

$result = mysql_query("SELECT * FROM categories order by category ASC");

while($row = mysql_fetch_array($result))
{
echo $row['category'];
echo "<br />";
}

?>

No comments posted yet

Your Answer:

Login to answer
103 Like 23 Dislike
Previous forums Next forums
Other forums

Open link with largest int string first
I have the following links i would like to open either all at once or one-by-one. How would i procee

Pre-Fill out a PHP form...??
This is for work actually (geek squad). We have to fill out this online php form at work over and ov

Uploading/Downloading files stored in MySQL database
Hey all,

This problem just came up in my website and I'm having a hard time figuring out what

update post issues
I am trying to create an update to a post function, while the update does occur, the page routing an

Extract specific information from a PHP Multidimensional Array
Howdy! I've racked my brain over this for 24 hours now. I think it's time I asked for help. I'm lear

Implementing Single Sign-On using SAML 1.1, x.509, LDAP in C#.net
Hi, I got a requirement from the client i.e implementing single sing on using SAML 1.1( LDAP &

Mysql query, two times?
Hello to all,

I'm new to php coding and i like it alot. I need help with some noob stuff.

Schedule editor
Hi,

I have a question related to Schedule editor.
If we schedule a BLS for every 30

does anyone know a php script to send mail using gmails/googles free smtp server
cause i heard u can do that but i dont know how

gmdate() - want 1 hr before time
Hi,
I am using php gmdate().
Now I am entering all dates in my dbase using gmdate("Y-m-d

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash