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
https://forums.phpfreaks.com/topic/179896-redirect-page/
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
https://forums.phpfreaks.com/topic/179896-redirect-page/#findComment-949348
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.