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

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.