iamLearning Posted May 8, 2013 Share Posted May 8, 2013 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 More sharing options...
jazzman1 Posted May 8, 2013 Share Posted May 8, 2013 In my life I've never seen the URL like that: ?page=video?id= Where did you find that? Link to comment https://forums.phpfreaks.com/topic/277776-header-location-problem/#findComment-1429016 Share on other sites More sharing options...
iamLearning Posted May 8, 2013 Author Share Posted May 8, 2013 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 https://forums.phpfreaks.com/topic/277776-header-location-problem/#findComment-1429072 Share on other sites More sharing options...
trq Posted May 8, 2013 Share Posted May 8, 2013 The location header requires a complete url. That is: http://somedomain.com/somefile?foo=bar Link to comment https://forums.phpfreaks.com/topic/277776-header-location-problem/#findComment-1429075 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.