Jump to content

Redirect page


j05hr

Recommended Posts

I'm not sure how to explain this, I'm following this tutorial on how to make a CMS but with the code I'm following they have a navigation bar but I don't, for my page I want to be able to click a button inside the content and then the content reloads with nothing in it. 

How can I do this? Here is my code...

 

<?php require_once("includes/connection.php"); ?>
<?php require_once("includes/functions.php"); ?>
<?php
if (isset($_GET['subj'])) {
	$sel_subj = $_GET['subj'];
	$sel_page = "";
} elseif (isset($_GET['page'])) {
	$sel_subj= "";
	$sel_page = $_GET['page'];
} else {
	$sel_subj = "";
	$sel_page = "";
}
?>
<?php include("includes/header.php"); ?>
<div id="content">
<h2> Buying Page</h2>
	<?php
	$subject_set = get_all_subjects();
	// 5. Use returned data
	while ($subject = mysql_fetch_array($subject_set)) { 
?> 
	<div class="menu-name"> <?php echo "<a href=\"content.php?page=" . urlencode($subject["id"]) .
		"\">{$subject["menu_name"]}</a>"; ?> </div>
	<div class="buying-text"> <?php echo "{$subject["content"]}"; ?> </div>
	<div class="image"> <?php echo "{$subject["image"]}"; ?> </div>

	<?php

		}
?>



</div>
<?php require("includes/footer.php"); ?>

 

So when they click on the button in the menu-class div I want it to reset the page if that makes sense?

 

Thanks,

Josh

Link to comment
Share on other sites

function redirect( $url ){
    if (! headers_sent( ) ){
    
        header( "Location: ".$url );
        exit( 0 );
    }
    echo "<script language=Javascript>document.location.href='".$url."';</script>";
    exit( 0 );
}


redirect('/'); //path to redirect to

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.