Jump to content

Header location problem


iamLearning

Recommended Posts

When I try to run this script, it sends me back to the homepage instead of the actual processed page. How could I set up the header location file using the bottom script I posted to process the page submitted in the top script? 

 

 

//Start submitting video
$dupeid = mysql_query("SELECT * FROM video WHERE youtubeid = '$youtubeid'");
if(mysql_num_rows($dupeid) == 0){
$insertquery = "INSERT INTO video (youtubeid) VALUES ('$youtubeid')";  
mysql_query($insertquery);  

header('Location: ?page=video?id='.$youtubeid);
//End Submitting video
}else{echo "Sorry that video has already been posted!";}
}
}else{
echo 'The link provided is not a working Youtube link. Please try again.';
}
}

?page is defined in this file

 


<?php
if (empty($_GET['page'])){
	header('Location: ?page=home');
	die();
	}

$core_path = dirname(__FILE__);

$pages = scanDir("{$core_path}/pages");
unset($pages[0],$pages[1]);

foreach ($pages as &$page){
$page = substr($page, 0, strpos($page, '.'));
}

if (in_array($_GET['page'], $pages)){
	$include_file = "{$core_path}/pages/{$_GET['page']}.php";
}else{
$include_file = "{$core_path}/pages/home.php";
}

if (array_key_exists('page', $_GET)) {
$currentpage = $_GET['page'];
}
?>

 

Link to comment
https://forums.phpfreaks.com/topic/277776-header-location-problem/
Share on other sites

In my life I've never seen the URL like that:

?page=video?id=

Where did you find that?

Yeah? Thanks for the helpful advice..... I'm new to PHP and I was trying to code base on what I had read. Obviously my code is not perfect, but hey? That's why I was trying to get help. Thanks for pointing that out.

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.