RoninStretch Posted August 30, 2007 Share Posted August 30, 2007 Hey again all.. Different question here. I'm using a switch with GET to determine which page to load in the main part of my site. so for example. main.php?action=WhateverPage would include WhateverPage.php into my main.php design. What i'm wondering is going from one included page to another. What's the best way to transfer data? So on the first page, let's say main.php?action=one we have a link to main.php?action=two but we need to send $id along too for using in the second page. I tried main.php?action=two&id=2 and then trying to GET it on the second page but it doesn't work. so how is this done? Quote Link to comment https://forums.phpfreaks.com/topic/67279-best-way-to-send-data-to-an-include/ Share on other sites More sharing options...
Jessica Posted August 30, 2007 Share Posted August 30, 2007 That will work. Did you do $id = $_GET['id']; on your second page? Quote Link to comment https://forums.phpfreaks.com/topic/67279-best-way-to-send-data-to-an-include/#findComment-337523 Share on other sites More sharing options...
RoninStretch Posted August 30, 2007 Author Share Posted August 30, 2007 yeah.. it will? Ok i was getting quite confused.. If you say it will work i'll go back and try again. ... Oh and thanks!! Quote Link to comment https://forums.phpfreaks.com/topic/67279-best-way-to-send-data-to-an-include/#findComment-337526 Share on other sites More sharing options...
RoninStretch Posted August 30, 2007 Author Share Posted August 30, 2007 I can't seem to figure it out.. I keep getting this error Warning: main(admin_News_del.php?id=1) [function.main]: failed to open stream: No such file or directory in /home/l/a/lanlounge_org/experimental/index.php on line 130 Warning: main() [function.include]: Failed opening 'admin_News_del.php?id=1' for inclusion (include_path='.:/usr/local/lib/php/') in /home/l/a/lanlounge_org/experimental/index.php on line 130" Here's my code.. index.php case "adminNewsDel": include 'admin_News_del.php; break; main_news.php - First page <a href='index.php?action=adminNewsDel&id=" . $storyID . "'>Delete</a> admin_News_del.php - Second page. $storyID = $_GET['id']; $query = "DELETE FROM fed_news WHERE id='$storyID'"; $result = mysql_query($query); echo ("News item " . $storyID . " deleted."); the link on main_news.php works fine.. it is linking to index.php?action=adminNewsDel&id=3 .. Lost! ??? Quote Link to comment https://forums.phpfreaks.com/topic/67279-best-way-to-send-data-to-an-include/#findComment-337537 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.