<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
	<channel>
		<title><![CDATA[KillerSites.com Web Design Forums - Problem with page redirecting: header("Location: $url");]]></title>
		<link>http://www.killersites.com/forums/topic/2410/problem-with-page-redirecting-headerlocation-url/</link>
		<description><![CDATA[The most recent posts in Problem with page redirecting: header("Location: $url");.]]></description>
		<lastBuildDate>Sat, 05 Dec 2009 20:23:24 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: Problem with page redirecting: header("Location: $url");]]></title>
			<link>http://www.killersites.com/forums/post/12744/#p12744</link>
			<description><![CDATA[<p>The server parsing this sgml document will add the necessary header(s) to Location:&nbsp; so the output from your PHP should be&nbsp; limited to&nbsp; &nbsp;print &quot;Location: $url&quot;;&nbsp; rather than&nbsp; &nbsp;header(&quot;Location: $url&quot;)&nbsp; &nbsp; ( would have the headers output in duplicate).</p>]]></description>
			<author><![CDATA[dummy@example.com (hoist0)]]></author>
			<pubDate>Sat, 05 Dec 2009 20:23:24 +0000</pubDate>
			<guid>http://www.killersites.com/forums/post/12744/#p12744</guid>
		</item>
		<item>
			<title><![CDATA[Re: Problem with page redirecting: header("Location: $url");]]></title>
			<link>http://www.killersites.com/forums/post/12147/#p12147</link>
			<description><![CDATA[<p>Hello everyone,</p><p>Thanks a lot for your all replies, I do want to post all the coding which are require or include for you, but I&#039;m wondering that my php pages are quite long, I hope you guys can understand all.<br />Please let me know if there is anything wrong. Sorry&nbsp; I didn&#039;t comment much in my php code, I should do that but sorry i am too busy. If you need any futher information, let me know pls. <br />Thanks a lot again</p><p>&quot;The main problem occurs in <span style="color: red">menu_manager.php</span> file, I think&quot;<br />Quyen,</p><p><span style="color: red">file content.php:</span><br /></p><div class="codebox"><pre><code>&lt;div class=&quot;page-wrapper&quot;&gt;
&lt;?php 
if(!isset($_SESSION[&#039;user_id&#039;])){
    header(&quot;location: alert_box.php?opt=no_permission&quot;);
}
else{
    if(isset($_GET[&quot;content&quot;])){
        $content = $_GET[&quot;content&quot;];
        switch($content){
            case &quot;home&quot;:
            break;
            case &quot;menus&quot;:
                require_once(&quot;menu_manager.php&quot;);
            break;
            case &quot;users&quot;:
                require_once(&quot;user_manager.php&quot;);
            break;
            case &quot;portfolio&quot;:
            break;
            case &quot;cart&quot;:
            break;
        }
    }
}
?&gt;
&lt;/div&gt;</code></pre></div><p><span style="color: red">file menu_manager.php:</span><br /></p><div class="codebox"><pre><code>&lt;?php                
    $query = &quot;SELECT * FROM menu 
              ORDER BY last_edit DESC&quot;;
    $result = mysql_query($query);
    $cnt_records = mysql_num_rows($result);
    if($cnt_records){
    $per_page = 10;
    $start = 0;
    $num_of_page = ceil($cnt_records/$per_page);
    if(isset($_GET[&#039;page&#039;])){
        $get_request = $_GET[&#039;page&#039;];
        if($get_request!=&quot;&quot;)
        {
            $start = ($get_request-1) * $per_page;
        }
        else
        {
            $start = 0;
        }
    }
    else{
    }
    ?&gt;
    &lt;link href=&quot;css/style.css&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot; /&gt;
    
        &lt;div class=&quot;sub-menuitems&quot;&gt;
            &lt;form name=&quot;formPaging&quot; id=&quot;formPaging&quot; action=&quot;index.php?content=menus&quot; method=&quot;post&quot;&gt; 
            &lt;?php 
            if($num_of_page &gt;=2){
            ?&gt;
            &lt;div class=&quot;items&quot;&gt;
                Page:
                &lt;select name=&quot;page&quot; id=&quot;page&quot; onchange=&quot;document.formPaging.submit()&quot;&gt;
                    &lt;option selected=&quot;selected&quot;&gt;Select one&lt;/option&gt;
                    &lt;?php 
                    for($index=1;$index &lt;= $num_of_page;$index++)
                    {
                        if($get_request == $index)
                        {
                            
                            echo &quot;&lt;option value=$index&gt;$index &lt;/font&gt;&quot;;
                        }
                        else
                        {
                            echo &quot;&lt;option value=$index&gt;$index &lt;/font&gt;&quot;;
                        }    
                    }
                    ?&gt;
                &lt;/select&gt;
                &lt;?php 
                if(isset($_POST[&#039;page&#039;])){
                    $selected = $_POST[&#039;page&#039;];
                    for($index=1;$index &lt;= $num_of_page;$index++)
                    {
                        if($get_request == $selected)
                        {
                            header(&quot;location: index.php?content=menus&amp;page=$selected&quot;);
                        }
                        else
                        {
                            header(&quot;location: index.php?content=menus&amp;page=$selected&quot;);
                        }    
                    }
                }
                ?&gt;
            &lt;/div&gt;
            &lt;?php 
            }
            ?&gt;
            &lt;/form&gt;
            &lt;form name=&quot;formMenuitemQuickLaunch&quot; id=&quot;formMenuitemQuickLaunch&quot; action=&quot;index.php?content=menus&amp;act=item&quot; method=&quot;post&quot;&gt;
            &lt;div class=&quot;items&quot;&gt;   
                Item: 
                &lt;select name=&quot;menu_id&quot; id=&quot;menu_id&quot; onchange=&quot;document.formMenuitemQuickLaunch.submit();&quot;&gt;
                    &lt;option&gt;Select one&lt;/option&gt;
                &lt;?php 
                if($cnt_records){
                    while($row = mysql_fetch_array($result)){
                        ?&gt;
                        &lt;option value=&quot;&lt;?php print $row[&#039;menu_id&#039;];?&gt;&quot;&gt;
                            &lt;?php 
                            print $row[&#039;name&#039;].&quot;--&quot;; 
                            if($row[&#039;type&#039;]==0){print &quot;B&quot;;}else{print &quot;F&quot;;}
                            ?&gt;
                        &lt;/option&gt;
                        &lt;?php
                    }
                }
                ?&gt;
                &lt;/select&gt;
            &lt;/div&gt;
            &lt;/form&gt;
            &lt;form name=&quot;formMenuGroup&quot; id=&quot;formMenuGroup&quot; action=&quot;index.php?content=menus&amp;page=1&quot; method=&quot;post&quot;&gt; 
            &lt;div class=&quot;items&quot;&gt;
                Quick launch: 
                &lt;select name=&quot;menuType&quot; id=&quot;menuType&quot; onchange=&quot;document.formMenuGroup.submit();&quot;&gt;
                    &lt;option value=&quot;none&quot;&gt;Select one&lt;/option&gt;
                    &lt;option value=&quot;all&quot;&gt;All&lt;/option&gt;
                    &lt;option value=&quot;backend&quot;&gt;Back-End&lt;/option&gt;
                    &lt;option value=&quot;frontend&quot;&gt;Front-End&lt;/option&gt;
                    &lt;option value=&quot;published&quot;&gt;Published&lt;/option&gt;
                    &lt;option value=&quot;unpublished&quot;&gt;Un-Published&lt;/option&gt;
                &lt;/select&gt;
            &lt;/div&gt;   
            &lt;/form&gt; 
        &lt;/div&gt;
        &lt;div class=&quot;sub-menuitems&quot;&gt;
            &lt;div class=&quot;items&quot;&gt;
                &lt;a href=&quot;#&quot;&gt;Delete&lt;/a&gt;
            &lt;/div&gt;
            &lt;div class=&quot;items&quot;&gt;
                &lt;a href=&quot;#&quot;&gt;Published&lt;/a&gt;
            &lt;/div&gt;
            &lt;div class=&quot;items&quot;&gt;
                &lt;a href=&quot;#&quot;&gt;None&lt;/a&gt;
            &lt;/div&gt;
            &lt;div class=&quot;items&quot;&gt;
                &lt;a href=&quot;#&quot; onclick=&quot;&quot;&gt;Select All&lt;/a&gt;
            &lt;/div&gt;
            
            &lt;div class=&quot;items&quot;&gt;
                &lt;a href=&quot;index.php?content=menus&amp;act=formAdd&quot;&gt;Add&lt;/a&gt;
            &lt;/div&gt;
        &lt;/div&gt;
        &lt;?php 
        if(!isset($_GET[&#039;act&#039;])){
            require_once(&quot;menu_content.php&quot;);
        }
        else{
            $action = $_GET[&#039;act&#039;];
            switch($action){
                case&quot;item&quot;:
                    if(isset($_POST[&#039;menu_id&#039;])){
                        $menu_id = $_POST[&#039;menu_id&#039;];
                        $query = &quot;SELECT * FROM menu
                                  WHERE menu_id = &#039;$menu_id&#039;
                                  &quot;;
                        $result_items = mysql_query($query);
                        $cnt_records = mysql_num_rows($result_items);
                        if($cnt_records){
                        ?&gt;
                        &lt;div class=&quot;sub-content&quot;&gt;
                        &lt;table&gt;
                            &lt;tr class=&quot;col-title&quot;&gt;
                                &lt;td&gt;ID&lt;/td&gt;
                                &lt;td&gt;Group&lt;/td&gt;
                                &lt;td&gt;Name&lt;/td&gt;
                                &lt;td&gt;Link name &lt;/td&gt;
                                &lt;td&gt;Ordering&lt;/td&gt;
                                &lt;td&gt;Published&lt;/td&gt;
                                &lt;td&gt;Details&lt;/td&gt;
                                &lt;td&gt;Edit&lt;/td&gt;
                                &lt;td&gt;Delete&lt;/td&gt;
                                &lt;td&gt;#&lt;/td&gt;
                            &lt;/tr&gt;
                        &lt;?php
                            while($row = mysql_fetch_array($result_items)){
                                require(&quot;menu_list.php&quot;);
                            }
                        ?&gt;
                        &lt;/table&gt;
                        &lt;/div&gt;
                        &lt;?php    
                        }
                    }
                break;
                
                case &quot;pos&quot;:
                    if(isset($_POST[&#039;pos&#039;])){
                        $ordering= $_POST[&#039;pos&#039;];
                        $menu_id = $_POST[&#039;menu_id&#039;];
                        $last_edit = date(&quot;F j, Y, g:i a&quot;);
                        $query = &quot;UPDATE menu
                                SET ordering = &#039;$ordering&#039;,last_edit = &#039;$last_edit&#039;
                                WHERE menu_id = &#039;$menu_id&#039; 
                                &quot;;
                        $result = mysql_query($query);
                        $cnt_records = mysql_num_rows($result);
                        if($result){
                            header(&quot;location: index.php?content=menus&quot;);
                        }
                    }
                break;
                case &#039;formAdd&#039;:
                    require_once(&quot;menu_adding_form.php&quot;);
                break;
                case &#039;add&#039;:
                    $type = $_POST[&#039;type&#039;];
                    $name = $_POST[&#039;name&#039;];
                    $link_to = $_POST[&#039;link_to&#039;];
                    $ordering = $_POST[&#039;ordering&#039;];
                    $created_date = date(&quot;F j, Y, g:i a&quot;);
                    $last_edit = date(&quot;F j, Y, g:i a&quot;);
                    if(isset($_POST[&#039;published&#039;])){
                        $status = 1;
                    }
                    else{
                        $status = 0;
                    }
                    if($name == &quot;&quot;){
                        header(&quot;location: alert_box.php?opt=empty&quot;);
                    }
                    else{
                        
                        $table = &quot;menu&quot;;
                        $cols = &quot;menu_id,type,name,link_to,ordering,
                                 status,created_date,last_edit
                                 &quot;;
                        $values = &quot;&#039;&#039;,&#039;$type&#039;,&#039;$name&#039;,&#039;$link_to&#039;,&#039;$ordering&#039;,
                                  &#039;$status&#039;,&#039;$created_date&#039;,&#039;$last_edit&#039;
                                  &quot;;
                        $query = &quot;INSERT INTO menu ($cols) 
                                  VALUES ($values)
                                 &quot;;
                        $result = mysql_query($query);
                        if($result){
                            header(&quot;location: index.php?content=menus&quot;);
                        }
                        else{
                            header(&quot;location: alert_box.php?opt=not_insert&quot;);
                        }
                    }
                break;
                case &quot;more&quot;:
                    if(isset($_GET[&#039;id&#039;])){
                        $menu_id = $_GET[&#039;id&#039;];
                        $query = &quot;SELECT * FROM menu 
                                  WHERE menu_id = &#039;$menu_id&#039;
                                  &quot;;
                        $result = mysql_query($query);
                        $cnt_records = mysql_num_rows($result);
                        if($cnt_records &gt; 0){
                            require(&quot;menu_editing_form.php&quot;);
                        }
                    }
                break;
                case &quot;edit&quot;:
                    $menu_id = $_POST[&#039;menu_id&#039;];
                    $type = $_POST[&#039;type&#039;];
                    $name = $_POST[&#039;name&#039;];
                    $link_to = $_POST[&#039;link_to&#039;];
                    $ordering = $_POST[&#039;ordering&#039;];
                    $last_edit = date(&quot;F j, Y, g:i a&quot;);
                    if(isset($_POST[&#039;published&#039;])){
                        $status = 1;
                    }
                    else{
                        $status = 0;
                    }
                    if($name == &quot;&quot;){
                        header(&quot;location: alert_box.php?opt=empty&quot;);
                    }
                    else{
                        $set = &quot;type = &#039;$type&#039;, 
                                name = &#039;$name&#039;,
                                link_to = &#039;$link_to&#039;,
                                ordering = &#039;$ordering&#039;, 
                                status = &#039;$status&#039;, 
                                last_edit = &#039;$last_edit&#039; &quot;;
                        $query = &quot;
                                 UPDATE menu
                                 SET $set 
                                 WHERE menu_id = &#039;$menu_id&#039;
                                 &quot;;
                        $result = mysql_query($query);
                        if($result){
                            header(&quot;location: index.php?content=menus&quot;);
                        }
                        else{
                            header(&quot;location: alert_box.php?opt=not_updated&quot;);
                        }
                    }
                break;
                case &quot;delete&quot;:
                    if(!isset($_GET[&#039;id&#039;])){}
                    else{
                        $menu_id = $_GET[&#039;id&#039;];
                        $query = &quot;DELETE FROM menu
                                  WHERE menu_id = &#039;$menu_id&#039;;
                                 &quot;;
                        $result = mysql_query($query);
                        if($result){
                            header(&quot;index.php?content=menus&quot;);
                        }
                        else{
                            print mysql_error();
                            
                            header(&quot;alert_box.php?opt=delete_error&quot;);
                        }
                    }
                break;
                
                case &quot;status&quot;:
                    if(isset($_GET[&#039;id&#039;]) &amp;&amp; isset($_GET[&#039;cur&#039;])){
                        $menu_id = $_GET[&#039;id&#039;];
                        $last_edit = date(&quot;F j, Y, g:i a&quot;);
                        $current_status = $_GET[&#039;cur&#039;];
                        if($current_status == 0){
                            $status = 1;
                        }
                        elseif($current_status == 1){
                            $status = 0;
                        }
                        else{
                            header(&quot;location: alert_box.php?opt=no_permission&quot;);
                        }
                        $query = &quot;UPDATE menu
                                  SET status = &#039;$status&#039;, last_edit = &#039;$last_edit&#039; 
                                  WHERE menu_id = $menu_id
                                 &quot;;
                        $result = mysql_query($query);
                        if($result){
                            header(&quot;location: index.php?content=menus&amp;page=1&quot;);
                        }
                        else{
                            header(&quot;location: alert_box.php?opt=not_updated&quot;);
                        }
                    }
                break;
            }
        }
    } 
?&gt;</code></pre></div><p><span style="color: red"> Required files:<br />menu_list.php<br /></span><br /></p><div class="codebox"><pre><code>&lt;tr&gt;
    &lt;td&gt;
        &lt;?php print $row[&#039;menu_id&#039;]?&gt;
    &lt;/td&gt;
    &lt;td&gt;
        &lt;?php 
        if($row[&#039;type&#039;] == 1){
            print &quot;Front-end&quot;;
        }
        else{
            print &quot;Back-end&quot;;
        }
        ?&gt;
    &lt;/td&gt;
    &lt;td&gt;
        &lt;?php print $row[&#039;name&#039;];?&gt;
    &lt;/td&gt;
    &lt;td&gt;
        &lt;?php print $row[&#039;link_to&#039;];?&gt;
    &lt;/td&gt;
    &lt;form name=&quot;orderingForm&quot; id=&quot;orderingForm&quot; action=&quot;index.php?content=menus&amp;act=pos&amp;page=1&quot; method=&quot;post&quot;&gt;
    &lt;td&gt;
        &lt;?php 
            print $row[&#039;ordering&#039;];
            $current_id = $row[&#039;menu_id&#039;];
        ?&gt;
        &lt;input type=&quot;hidden&quot; name=&quot;menu_id&quot; id=&quot;menu_id&quot; value=&quot;&lt;?php print $current_id;?&gt;&quot; /&gt;
        &lt;?php 
        if(!isset($_GET[&#039;act&#039;])){
        }
        else{
            ?&gt;
            &lt;select name=&quot;pos&quot; id=&quot;pos&quot; onchange=&quot;submitFormOrdering()&quot;&gt;
                &lt;option selected=&quot;selected&quot;&gt;Select&lt;/option&gt;
                &lt;?php 
                $query = &quot;SELECT * FROM menu&quot;;
                $result = mysql_query($query);
                $cnt_records = mysql_num_rows($result);
                for($i= 1; $i&lt;= $cnt_records; $i++){
                    ?&gt;
                    &lt;option&gt;&lt;?php print $i;?&gt;&lt;/option&gt;
                    &lt;?php
                }
                ?&gt;
            &lt;/select&gt;
         &lt;?php 
             }
         ?&gt;
    &lt;/td&gt;
    &lt;/form&gt;
    &lt;td&gt;
        &lt;?php 
        if($row[&#039;status&#039;] == 1){
            print &quot;&lt;a href=&#039;index.php?content=menus&amp;act=status&amp;id=&quot;; print $row[&#039;menu_id&#039;].&quot;&amp;cur=&quot;; print $row[&#039;status&#039;].&quot;&#039;&gt;&lt;font color=&#039;#FF3300&#039;&gt;Yes&lt;/font&gt; &lt;/a&gt;&quot;;
        }
        else{
            print &quot;&lt;a href=&#039;index.php?content=menus&amp;act=status&amp;id=&quot;; print $row[&#039;menu_id&#039;].&quot;&amp;cur=&quot;; print $row[&#039;status&#039;].&quot;&#039;&gt;&lt;font color=&#039;#006600&#039;&gt; No &lt;/font&gt; &lt;/a&gt;&quot;;

        }
        ?&gt;
    &lt;/td&gt;
        &lt;td&gt;
            &lt;a href=&quot;index.php?content=menus&amp;act=more&amp;id=&lt;?php print $row[&#039;menu_id&#039;];?&gt;&quot;&gt;Detail&lt;/a&gt;
        &lt;/td&gt;
    &lt;td&gt;
        &lt;a href=&quot;index.php?content=menus&amp;act=more&amp;id=&lt;?php print $row[&#039;menu_id&#039;];?&gt;&quot;&gt;Edit&lt;/a&gt;
    &lt;/td&gt;
    &lt;td&gt;
        &lt;a href=&quot;index.php?content=menus&amp;act=delete&amp;id=&lt;?php print $row[&#039;menu_id&#039;];?&gt;&quot;&gt;Delete&lt;/a&gt;
    &lt;/td&gt;
    &lt;td&gt;
    &lt;form name=&quot;multiSelectedForm&quot; id=&quot;multiSelectedForm&quot;&gt;
        &lt;input type=&quot;checkbox&quot; name=&quot;selectedItems&quot; id=&quot;selectedItems&quot; /&gt;
    &lt;/form&gt;
    &lt;/td&gt;
&lt;/tr&gt;</code></pre></div><p><span style="color: red">menu_adding_form.php</span></p><div class="codebox"><pre><code>&lt;link href=&quot;css/style.css&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot; /&gt;
&lt;div class=&quot;sub-content&quot;&gt;
    &lt;table&gt;
        &lt;tr class=&quot;form-title&quot;&gt;
            &lt;td colspan=&quot;2&quot;&gt;Add a new menuitem&lt;/td&gt;
        &lt;/tr&gt;
        &lt;form name=&quot;menuAddingForm&quot; id=&quot;menuAddingForm&quot; method=&quot;post&quot; action=&quot;index.php?content=menus&amp;act=add&quot;&gt;
        &lt;tr&gt;
            &lt;td class=&quot;comp-title&quot;&gt;Group of menu &lt;/td&gt;
            &lt;td&gt;
                &lt;select name=&quot;type&quot; id=&quot;type&quot;&gt;
                    &lt;option value=&quot;1&quot;&gt;Front-End&lt;/option&gt;
                    &lt;option value=&quot;0&quot;&gt;Back-End&lt;/option&gt;
                &lt;/select&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td class=&quot;comp-title&quot;&gt;Menuitem name&lt;/td&gt;
            &lt;td&gt;&lt;input type=&quot;text&quot; name=&quot;name&quot; id=&quot;name&quot; /&gt;&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td class=&quot;comp-title&quot;&gt;Link to&lt;/td&gt;
            &lt;td&gt;
                &lt;select name=&quot;link_to&quot; id=&quot;link_to&quot;&gt;
                    &lt;option value=&quot;home&quot;&gt;Home page&lt;/option&gt;
                    &lt;option value=&quot;aboutus&quot;&gt;About Us&lt;/option&gt;
                    &lt;option value=&quot;webdesigns&quot;&gt;Web Designs&lt;/option&gt;
                    &lt;option value=&quot;webtemplates&quot;&gt;Web Templates&lt;/option&gt;
                    &lt;option value=&quot;contact&quot;&gt;Contact Us&lt;/option&gt;
                    &lt;option value=&quot;cart&quot;&gt;Shopping Cart&lt;/option&gt;
                    
                    &lt;option value=&quot;menus&quot;&gt;Menus&lt;/option&gt;
                    &lt;option value=&quot;users&quot;&gt;Users&lt;/option&gt;
                &lt;/select&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td class=&quot;comp-title&quot;&gt;Ordering&lt;/td&gt;
            &lt;td&gt;
                &lt;select name=&quot;ordering&quot; id=&quot;ordering&quot;&gt;
                    &lt;?php 
                    $query = &quot;SELECT * FROM menu&quot;;
                    $result = mysql_query($query);
                    $cnt_records = mysql_num_rows($result);
                    for($i= 1; $i&lt;= $cnt_records; $i++){
                        print &#039;&lt;option&gt;&#039;.$i.&#039;&lt;/option&gt;&#039;;
                    }
                    ?&gt;
                    &lt;option&gt;&lt;?php print $cnt_records + 1?&gt;&lt;/option&gt;
                &lt;/select&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td class=&quot;comp-title&quot;&gt;Published&lt;/td&gt;
            &lt;td&gt;
                &lt;input type=&quot;checkbox&quot; name=&quot;published&quot; id=&quot;published&quot;/&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td class=&quot;comp-title&quot;&gt; Enter or click
            &lt;/td&gt;
            &lt;td&gt;
                &lt;input type=&quot;submit&quot; value=&quot;Save this record&quot;/&gt;
                &lt;input type=&quot;reset&quot;  name=&quot;reset&quot; value=&quot;Reset&quot;/&gt;
                &lt;input type=&quot;reset&quot;  name=&quot;cancel&quot; value=&quot;Cancel&quot; onClick=&quot;javascript: history.go(-1);&quot;/&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
        &lt;/form&gt;
    &lt;/table&gt;
&lt;/div&gt;</code></pre></div><p><span style="color: red">menu_editing_form.php</span><br /></p><div class="codebox"><pre><code>&lt;div class=&quot;sub-content&quot;&gt;
    &lt;table&gt;
        &lt;tr class=&quot;form-title&quot;&gt;
            &lt;td colspan=&quot;2&quot;&gt;Detail of menuitems &lt;font color=&quot;#CC3300&quot;&gt; &quot; &lt;?php print $menu_id; ?&gt; &quot;&lt;/font&gt;&lt;/td&gt;
        &lt;/tr&gt;
        &lt;form name=&quot;menuEditingForm&quot; id=&quot;menuEditingForm&quot; method=&quot;post&quot; action=&quot;index.php?content=menus&amp;act=edit&quot;&gt;
        &lt;tr&gt;
            &lt;td class=&quot;comp-title&quot;&gt;Group of menu &lt;/td&gt;
            &lt;td&gt;
                &lt;select name=&quot;type&quot; id=&quot;type&quot;&gt;
                    &lt;?php 
                    while($row = mysql_fetch_array($result)){
                    ?&gt;
                    &lt;option value=&quot;&lt;?php  print $row[&#039;type&#039;];?&gt;&quot; selected&gt;
                        &lt;?php 
                        $menu_id = $row[&#039;menu_id&#039;];
                        $type = $row[&#039;type&#039;];
                        $name = $row[&#039;name&#039;];
                        $link_to = $row[&#039;link_to&#039;];
                        $status = $row[&#039;status&#039;];
                        $ordering = $row[&#039;ordering&#039;];
                        $created_date = $row[&#039;created_date&#039;];
                        $last_edit = $row[&#039;last_edit&#039;];
                        if($type ==  0){
                            print &quot;Back-End&quot;;
                        }
                        else{
                            print &quot;Front-End&quot;;
                        }
                        ?&gt;
                    &lt;/option&gt;
                    &lt;?php 
                    }
                    if($type == 0){
                        ?&gt;
                        &lt;option value=&quot;1&quot; &gt;Front-End&lt;/option&gt;
                        &lt;?php
                    }
                    else{
                        ?&gt;
                        &lt;option value=&quot;0&quot; &gt;Back-End&lt;/option&gt;
                        &lt;?php
                    }
                    ?&gt;
                &lt;/select&gt;
                &lt;input type=&quot;hidden&quot; name=&quot;menu_id&quot; id=&quot;menu_id&quot; value=&quot;&lt;?php print $menu_id; ?&gt;&quot;&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td class=&quot;comp-title&quot;&gt;Menuitem name&lt;/td&gt;
            &lt;td&gt;&lt;input type=&quot;text&quot; name=&quot;name&quot; id=&quot;name&quot;  value=&quot;&lt;?php print  $name; ?&gt;&quot;/&gt;&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td class=&quot;comp-title&quot;&gt;Link to&lt;/td&gt;
            &lt;td&gt;
                
                &lt;select name=&quot;link_to&quot; id=&quot;link_to&quot;&gt;
                    &lt;option value=&quot;&lt;?php print $link_to;?&gt;&quot; selected&gt;&lt;?php print $link_to;?&gt;&lt;/option&gt;
                    &lt;?php 
                    $query = &quot;SELECT * FROM menu
                              WHERE link_to &lt;&gt; &#039;$link_to&#039;
                              ORDER BY ordering ASC
                             &quot;;
                    $result = mysql_query($query);
                    $cnt_records = mysql_num_rows($result);
                    if($cnt_records){
                        while($row = mysql_fetch_array($result)){
                            $type = $row[&#039;type&#039;];
                        ?&gt;
                        &lt;option value=&quot;&lt;?php print $row[&#039;link_to&#039;];?&gt;&quot;&gt;
                            &lt;?php 
                            print $row[&#039;link_to&#039;].&quot;--&quot;;
                            if($type == 0){
                                print &quot;Back&quot;;
                            }
                            else{
                                print &quot;Front&quot;;
                            }
                            ?&gt;
                        &lt;/option&gt;
                        &lt;?php
                        }
                    }
                    ?&gt;
                &lt;/select&gt;
            &lt;/td&gt;
           
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td class=&quot;comp-title&quot;&gt;Ordering&lt;/td&gt;
            &lt;td&gt;
                &lt;select name=&quot;ordering&quot; id=&quot;ordering&quot;&gt;
                    &lt;?php 
                    $query = &quot;SELECT * FROM menu&quot;;
                    $result = mysql_query($query);
                    $cnt_records = mysql_num_rows($result);
                    for($i= 1; $i&lt;= $cnt_records; $i++){
                    $start = $i + 1;
                    ?&gt;
                    &lt;option &lt;?php if($ordering == $i){?&gt;selected=&quot;selected&quot; &lt;?php }?&gt;&gt;
                        &lt;?php  print $i;?&gt;
                    &lt;/option&gt;
                    &lt;?php
                    }
                    ?&gt;
                &lt;/select&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td class=&quot;comp-title&quot;&gt;Published&lt;/td&gt;
            &lt;td&gt;
                &lt;input type=&quot;checkbox&quot; name=&quot;published&quot; id=&quot;published&quot; &lt;?php if ($status == true){ ?&gt;checked&lt;?php } ?&gt; /&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td class=&quot;comp-title&quot;&gt;Created on &lt;/td&gt;
            &lt;td&gt;
                &lt;label&gt;&lt;?php print $created_date; ?&gt;&lt;/label&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td class=&quot;comp-title&quot;&gt;Last edited&lt;/td&gt;
            &lt;td&gt;
                &lt;label&gt;&lt;?php print $last_edit ; ?&gt;&lt;/label&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td class=&quot;comp-title&quot;&gt; Enter or click
            &lt;/td&gt;
            &lt;td&gt;
                &lt;input type=&quot;submit&quot; value=&quot;Save this record&quot;/&gt;
                &lt;input type=&quot;reset&quot;  name=&quot;reset&quot; value=&quot;Reset&quot;/&gt;
                &lt;input type=&quot;reset&quot;  name=&quot;cancel&quot; value=&quot;Cancel&quot; onClick=&quot;javascript: history.go(-1);&quot;/&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
        &lt;/form&gt;
    &lt;/table&gt;
&lt;/div&gt;</code></pre></div>]]></description>
			<author><![CDATA[dummy@example.com (quyen)]]></author>
			<pubDate>Fri, 13 Nov 2009 05:27:48 +0000</pubDate>
			<guid>http://www.killersites.com/forums/post/12147/#p12147</guid>
		</item>
		<item>
			<title><![CDATA[Re: Problem with page redirecting: header("Location: $url");]]></title>
			<link>http://www.killersites.com/forums/post/12143/#p12143</link>
			<description><![CDATA[<p>What is on line 15?</p><p>Or better yet, post the full page code, please.<br />There must be <strong>nothing (even a blank space) sent to the Browser</strong> before the header(), or that error results. Check in your included/required files as well.</p><p>*edit*</p><p>Wrap the entire page in an ob_start() function to avoid a leak to the browser.</p><p><a href="http://php.net/manual/en/function.ob-start.php" rel="nofollow">http://php.net/manual/en/function.ob-start.php</a></p>]]></description>
			<author><![CDATA[dummy@example.com (jlhaslip)]]></author>
			<pubDate>Fri, 13 Nov 2009 01:59:27 +0000</pubDate>
			<guid>http://www.killersites.com/forums/post/12143/#p12143</guid>
		</item>
		<item>
			<title><![CDATA[Re: Problem with page redirecting: header("Location: $url");]]></title>
			<link>http://www.killersites.com/forums/post/12136/#p12136</link>
			<description><![CDATA[<div class="quotebox"><cite>christalix wrote:</cite><blockquote><p>ok, thefirst correction l will do in your code is to change the position of the require.</p></blockquote></div><p>That would change the functionality -- there is nothing wrong with that particular line of code. The issue is about the header, not the include.</p>]]></description>
			<author><![CDATA[dummy@example.com (falkencreative)]]></author>
			<pubDate>Thu, 12 Nov 2009 20:44:40 +0000</pubDate>
			<guid>http://www.killersites.com/forums/post/12136/#p12136</guid>
		</item>
		<item>
			<title><![CDATA[Re: Problem with page redirecting: header("Location: $url");]]></title>
			<link>http://www.killersites.com/forums/post/12135/#p12135</link>
			<description><![CDATA[<p>ok, thefirst correction l will do in your code is to change the position of the require.</p><p>&nbsp; &nbsp; &nbsp; &nbsp; case &#039;formAdd&#039;:<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; require_once(&quot;menu_adding_form.php&quot;);<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;</p><br /><p>should be:<br />&lt;?php<br />&nbsp; &nbsp; &nbsp;require_once(&quot;menu_adding_form.php&quot;);<br />&nbsp; &nbsp; &nbsp;<br />&nbsp; &nbsp; then&nbsp; switch something&nbsp; eg. switch($v){<br />&nbsp; &nbsp; &nbsp; &nbsp; <br />&nbsp; &nbsp; &nbsp; &nbsp;case &#039;formAdd&#039;:<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </p><br /><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;</p><br /><p>}<br />?&gt;</p><br /><p>If u need more assist let me know..</p>]]></description>
			<author><![CDATA[dummy@example.com (christalix)]]></author>
			<pubDate>Thu, 12 Nov 2009 19:16:27 +0000</pubDate>
			<guid>http://www.killersites.com/forums/post/12135/#p12135</guid>
		</item>
		<item>
			<title><![CDATA[Re: Problem with page redirecting: header("Location: $url");]]></title>
			<link>http://www.killersites.com/forums/post/12132/#p12132</link>
			<description><![CDATA[<p>Yeah this is my php code: it may show you something easy to understand.</p><div class="codebox"><pre><code>                case &#039;formAdd&#039;:
                    require_once(&quot;menu_adding_form.php&quot;);
                break;
                case &#039;add&#039;:
                    $type = $_POST[&#039;type&#039;];
                    $name = $_POST[&#039;name&#039;];
                    $link_to = $_POST[&#039;link_to&#039;];
                    $ordering = $_POST[&#039;ordering&#039;];
                    $created_date = date(&quot;F j, Y, g:i a&quot;);
                    $last_edit = date(&quot;F j, Y, g:i a&quot;);
                    if(isset($_POST[&#039;published&#039;])){
                        $status = 1;
                    }
                    else{
                        $status = 0;
                    }
                    if($name == &quot;&quot;){
                        header(&quot;location: alert_box.php?opt=empty&quot;);
                    }
                    else{
                        
                        $table = &quot;menu&quot;;
                        $cols = &quot;menu_id,type,name,link_to,ordering,
                                 status,created_date,last_edit
                                 &quot;;
                        $values = &quot;&#039;&#039;,&#039;$type&#039;,&#039;$name&#039;,&#039;$link_to&#039;,&#039;$ordering&#039;,
                                  &#039;$status&#039;,&#039;$created_date&#039;,&#039;$last_edit&#039;
                                  &quot;;
                        $query = &quot;INSERT INTO menu ($cols) 
                                  VALUES ($values)
                                 &quot;;
                        $result = mysql_query($query);
                        if($result){
                            header(&quot;location: index.php?content=menus&quot;);
                        }
                        else{
                            header(&quot;location: alert_box.php?opt=not_insert&quot;);
                        }
                    }
                break;
                case &quot;more&quot;:
                    if(isset($_GET[&#039;id&#039;])){
                        $menu_id = $_GET[&#039;id&#039;];
                        $query = &quot;SELECT * FROM menu 
                                  WHERE menu_id = &#039;$menu_id&#039;
                                  &quot;;
                        $result = mysql_query($query);
                        $cnt_records = mysql_num_rows($result);
                        if($cnt_records &gt; 0){
                            require(&quot;menu_editing_form.php&quot;);
                        }
                    }
                break;
                case &quot;edit&quot;:
                    $menu_id = $_POST[&#039;menu_id&#039;];
                    $type = $_POST[&#039;type&#039;];
                    $name = $_POST[&#039;name&#039;];
                    $link_to = $_POST[&#039;link_to&#039;];
                    $ordering = $_POST[&#039;ordering&#039;];
                    $last_edit = date(&quot;F j, Y, g:i a&quot;);
                    if(isset($_POST[&#039;published&#039;])){
                        $status = 1;
                    }
                    else{
                        $status = 0;
                    }
                    if($name == &quot;&quot;){
                        header(&quot;location: alert_box.php?opt=empty&quot;);
                    }
                    else{
                        $set = &quot;type = &#039;$type&#039;, 
                                name = &#039;$name&#039;,
                                link_to = &#039;$link_to&#039;,
                                ordering = &#039;$ordering&#039;, 
                                status = &#039;$status&#039;, 
                                last_edit = &#039;$last_edit&#039; &quot;;
                        $query = &quot;
                                 UPDATE menu
                                 SET $set 
                                 WHERE menu_id = &#039;$menu_id&#039;
                                 &quot;;
                        $result = mysql_query($query);
                        if($result){
                            header(&quot;location: index.php?content=menus&quot;);
                        }
                        else{
                            header(&quot;location: alert_box.php?opt=not_updated&quot;);
                        }
                    }
                break;</code></pre></div><p>Thanks a lot<br />Quyen,</p>]]></description>
			<author><![CDATA[dummy@example.com (quyen)]]></author>
			<pubDate>Thu, 12 Nov 2009 18:51:05 +0000</pubDate>
			<guid>http://www.killersites.com/forums/post/12132/#p12132</guid>
		</item>
		<item>
			<title><![CDATA[Re: Problem with page redirecting: header("Location: $url");]]></title>
			<link>http://www.killersites.com/forums/post/12131/#p12131</link>
			<description><![CDATA[<p>sure you can use header as many times as you want so far as they are in an </p><p>IF(){</p><p>yourcode <br />header(&#039;&#039;)<br />}elseif(){<br />yourcode 2<br />header(&#039;&#039;)</p><p>}<br />elseif(){<br />yourcode 3<br />header(&#039;&#039;)</p><p>}</p><p>same as for <br />Foreach(){} ect and also in a function myFunction(){}</p><p>Making sure none of the gloabal variables concides with another.</p>]]></description>
			<author><![CDATA[dummy@example.com (christalix)]]></author>
			<pubDate>Thu, 12 Nov 2009 18:44:37 +0000</pubDate>
			<guid>http://www.killersites.com/forums/post/12131/#p12131</guid>
		</item>
		<item>
			<title><![CDATA[Re: Problem with page redirecting: header("Location: $url");]]></title>
			<link>http://www.killersites.com/forums/post/12130/#p12130</link>
			<description><![CDATA[<p>Thanks for your reply,</p><p>Yeah you&#039;re right, I&#039;ve used Header(); quite a lot in my php pages, ofcourse I used it for different purposes, I&#039;ve been trying to comment all the //Headers, and use print &quot;somthing&quot;; to replaces Header commands, it works fine, but Whenever I remove one of the comment lines, the warning will appear straight away.</p><p>I am sure I did something wrong, but I haven&#039;t found it yet. Maybe I already used Header in the file which is required in the php page. But I think you can use multiple Headers command on the same page or include or require, right?</p><p>Thanks a lot for your help but really I don&#039;t want to use javascript in this case, because&nbsp; users can turn it off anytime, that means my website won&#039;t work ok without JS</p><p>Quyen,</p>]]></description>
			<author><![CDATA[dummy@example.com (quyen)]]></author>
			<pubDate>Thu, 12 Nov 2009 18:33:30 +0000</pubDate>
			<guid>http://www.killersites.com/forums/post/12130/#p12130</guid>
		</item>
		<item>
			<title><![CDATA[Re: Problem with page redirecting: header("Location: $url");]]></title>
			<link>http://www.killersites.com/forums/post/12127/#p12127</link>
			<description><![CDATA[<p>if l wll be you, l will use a javascript.</p><p>define something like <br />$ready=&lt;a href =&#039;url&#039;&lt;/a&gt;;</p><br /><p>then use javascript code&nbsp; and refer the $ready in the javascript.</p><p>It is very easy. If you can not handle it, let me know and l will post you a full written java script code!</p><br /><p>However, your warning seems like you have two</p><p> if(isset($_POST[&#039;xxxx&#039;])) {<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; header(&quot;Location: url&quot;);</p><br /><p>if this is the case, do well to delete one since the error message is telling you that, the header has already sent a location and you are trying to overwrite on the older one....</p><br /><br /><br /><br /><div class="quotebox"><blockquote><p>&quot;Warning: Cannot modify header information - headers already sent by (output started at C:\Inetpub\vhosts\qwebdesign.net\httpdocs\admin\index.php:15) in C:\Inetpub\vhosts\qwebdesign.net\httpdocs\admin\user_manager.php on line 319&quot;</p></blockquote></div><p>check the line 319 of the user_mnager.php and the line 15 of the index.php. There is a conflict......&gt;the index.php header you are trying to write has already been sent by the user_manager.php. And l bet you have included one of them in the other.</p><br /><p>Best Regards</p>]]></description>
			<author><![CDATA[dummy@example.com (christalix)]]></author>
			<pubDate>Thu, 12 Nov 2009 18:15:58 +0000</pubDate>
			<guid>http://www.killersites.com/forums/post/12127/#p12127</guid>
		</item>
		<item>
			<title><![CDATA[Re: Problem with page redirecting: header("Location: $url");]]></title>
			<link>http://www.killersites.com/forums/post/12125/#p12125</link>
			<description><![CDATA[<p>I&#039;ve been trying to solve my problem by using <a href="http://www.desilva.biz/php/phprefresh.html" rel="nofollow">http://www.desilva.biz/php/phprefresh.html</a> and <a href="http://www.tizag.com/javascriptT/javascriptredirect.php," rel="nofollow">http://www.tizag.com/javascriptT/javasc &#133; irect.php,</a> but I haven&#039;t solved my problems yet, I will try some other solutions, but I am still looking for someone to help me. I know &quot;<span style="color: red">Warning: Cannot modify header information - headers already sent by (output started at C:\Inetpub\vhosts\qwebdesign.net\httpdocs\admin\index.php:15) in C:\Inetpub\vhosts\qwebdesign.net\httpdocs\admin\user_manager.php on line 319</span>&quot; is just a warning, not an error, but the thing is I don&#039;t want this warning to show up on the page, and whenever this warning is occurs, it stops redirecting. I will try to use Adam&#039;s solution and see what&#039;ll happen....</p><p>Thank you very much Adam,<br />Quyen,</p>]]></description>
			<author><![CDATA[dummy@example.com (quyen)]]></author>
			<pubDate>Thu, 12 Nov 2009 17:47:48 +0000</pubDate>
			<guid>http://www.killersites.com/forums/post/12125/#p12125</guid>
		</item>
		<item>
			<title><![CDATA[Re: Problem with page redirecting: header("Location: $url");]]></title>
			<link>http://www.killersites.com/forums/post/12115/#p12115</link>
			<description><![CDATA[<p>I am not sure if this has been solved yet, but <a href="http://webdesign.about.com/od/metataglibraries/a/aa080300a.htm" rel="nofollow">http://webdesign.about.com/od/metatagli &#133; 80300a.htm</a> may be of some assistance. After you understand how to use the meta tag you can then echo it to effectively redirect. </p><p>Ex. &quot;&nbsp; &nbsp;echo &quot;&lt;meta http-equiv=&quot;refresh&quot; content=&quot;2;url=http://example.com&quot;&gt;&quot;;&nbsp; &nbsp;&quot;<br />This will refresh the page at the new location (&quot;<a href="http://example.com" rel="nofollow">http://example.com</a>&quot;) in 2 seconds.</p><p>&quot;http-equiv=&quot;refresh&quot; &quot; Is some what self explanatory, it will cause a refresh but if there is a url value in &#039;content&#039; then it will refresh with a new location.</p><p>&quot; content=&quot;2;url=http://example.com&quot; &quot; &#039; content=&quot;2 &#039; is where you can set the amount of time (in seconds) that the browser will wait before refreshing. &#039; url=http://example.com &#039; is where it will go upon refreshing.</p><p>It has proven a worthy alternative for me when&nbsp; &quot;header(&quot;location: &quot;)&quot; redirecting just doesn&#039;t seem to fit.</p><p>Hope it helps you out.</p><p>-Adam</p>]]></description>
			<author><![CDATA[dummy@example.com (adamlen)]]></author>
			<pubDate>Thu, 12 Nov 2009 10:24:23 +0000</pubDate>
			<guid>http://www.killersites.com/forums/post/12115/#p12115</guid>
		</item>
		<item>
			<title><![CDATA[Re: Problem with page redirecting: header("Location: $url");]]></title>
			<link>http://www.killersites.com/forums/post/11908/#p11908</link>
			<description><![CDATA[<p>Thanks a lot Wickham and falkencreative, I am sure I can solve my problems soon. Thanks again.</p><p>Quyen,</p>]]></description>
			<author><![CDATA[dummy@example.com (quyen)]]></author>
			<pubDate>Thu, 05 Nov 2009 07:45:14 +0000</pubDate>
			<guid>http://www.killersites.com/forums/post/11908/#p11908</guid>
		</item>
		<item>
			<title><![CDATA[Re: Problem with page redirecting: header("Location: $url");]]></title>
			<link>http://www.killersites.com/forums/post/11862/#p11862</link>
			<description><![CDATA[<p>Here&#039;s the same thing in PHP, using header(&#039;refresh: &#039;):<br /><a href="http://www.desilva.biz/php/phprefresh.html" rel="nofollow">http://www.desilva.biz/php/phprefresh.html</a></p>]]></description>
			<author><![CDATA[dummy@example.com (falkencreative)]]></author>
			<pubDate>Wed, 04 Nov 2009 18:38:21 +0000</pubDate>
			<guid>http://www.killersites.com/forums/post/11862/#p11862</guid>
		</item>
		<item>
			<title><![CDATA[Re: Problem with page redirecting: header("Location: $url");]]></title>
			<link>http://www.killersites.com/forums/post/11861/#p11861</link>
			<description><![CDATA[<p>It is also possible to do this with Javascript and a time delay:<br /><a href="http://www.tizag.com/javascriptT/javascriptredirect.php" rel="nofollow">http://www.tizag.com/javascriptT/javascriptredirect.php</a></p><p>(Though if Javascript is turned off, this obviously won&#039;t work.)</p>]]></description>
			<author><![CDATA[dummy@example.com (falkencreative)]]></author>
			<pubDate>Wed, 04 Nov 2009 18:35:46 +0000</pubDate>
			<guid>http://www.killersites.com/forums/post/11861/#p11861</guid>
		</item>
		<item>
			<title><![CDATA[Re: Problem with page redirecting: header("Location: $url");]]></title>
			<link>http://www.killersites.com/forums/post/11860/#p11860</link>
			<description><![CDATA[<div class="quotebox"><cite>quyen wrote:</cite><blockquote><p>Well, I&#039;ve tried that before but when you use headers to show a message before redirect to a page, actually you cannot see the message, the headers will execute straight away.</p></blockquote></div><p>Yes, I suppose that&#039;s obvious and I should have thought of that !</p><p>It would be seen <br />1) if the header url didn&#039;t work<br />2) if you add in a delay to the header url function.</p>]]></description>
			<author><![CDATA[dummy@example.com (Wickham)]]></author>
			<pubDate>Wed, 04 Nov 2009 17:00:01 +0000</pubDate>
			<guid>http://www.killersites.com/forums/post/11860/#p11860</guid>
		</item>
	</channel>
</rss>
