Jump to content

Best way to send data to an include.


RoninStretch

Recommended Posts

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?

Link to comment
Share on other sites

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!  ???

 

 

 

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.