Redirect user to particular page after complete a process

Dear All:

I have a listing of category code show on the table on format(dsp_catlist.php). On that page can add new category by click on the “New” button (direct to act_addcat.php), or edit the particular records by click on the hypertext link(direct to act_editcat.php). and select to delete the category by checked on the checkbox and click delete(direct to act_deletecat.php).

The question are, how should i code so that after the add or edit or delete process it will redirect back to the dsp_catlist.php with the refreshed data.

Thank for advices.

Look into using a meta refresh tag.

You could also use the header() function:

[php]
header(“location:./some/location”);
[/php]

But it must be done before any other HTML is sent. Otherwise you should consider the Meta Refresh as Ragster suggested.

Oh, yeah! :slight_smile:

Thanks for the advices.

I tried the below:

[php]

<?php include("list_var.php"); $dbconnect; $db; $cat = $_REQUEST['cat']; $desc = $_REQUEST['desc']; $sql_insertcategory; $sql_insertcategory .= "("${cat}","${desc}")"; $query = mysql_query($sql_insertcategory) ; if (!$query) { die('Could not query:' . mysql_error()); } else { header('Location:./home/dsp_catlist.php'); } ?>

[/php]

The error prompt as below:

Warning: Cannot modify header information - headers already sent by (output started at c:inetpubwwwroothomelegancelist_var.php:70) in c:inetpubwwwroothomeleganceact_addcategory.php on line 16

Anybody can help me on this.

Thank You[/b]

Your problem is what lies in your list_var.php file. This is sending data to your browser BEFORE the header function is called. You can have no data sent to your browser (including whitespace) before this function is called.

Sponsor our Newsletter | Privacy Policy | Terms of Service