TeamPhotoshop
Reviews, updates and in depth guides to your favourite mobile games - AppGamer.com
Forum Home Latest Posts Search Help Subscribe

Targetting in PHP

Page: 1 2 Reply
Jan 26th 2004#139608 Report
Member since: Jul 19th 2003
Posts: 810
Hey Hey Compadres,

Was hoping that someone can help me with this question... im sure its nowhere near as hard as i am making it for myself but ......

How do i write a PHP page where the information on the linked pages open up into a table??

I have this site : http://www.pixelated-designs.co.uk/testsites/LRv6/poss2/index02.php

and i want to display the pages which arte linked to it in the table where the blank content is at the moment..

Please help

Marc
Reply with Quote Reply
Jan 26th 2004#139657 Report
Member since: Mar 29th 2003
Posts: 1326
The pages which are linked to it? I dont think thats possible. Unless you know the pages, in which case you can use includes, or read the information into an array so that you can write a loop and make table rows, I guess.

Not a very good question, IMO - rephrase it.
Reply with Quote Reply
Jan 27th 2004#139721 Report
Member since: Mar 20th 2001
Posts: 3367
Yeah.. rephrase it cause i've not a single clue what you're asking
Reply with Quote Reply
Jan 27th 2004#139764 Report
Member since: Jul 19th 2003
Posts: 810
ok.... Let me give a simpler example......

In HTML.. when you use I Frames... you can make the pages in the site load into one i frame by using targets.... you know that?

In PHP..... I have a Table..... I want to make the pages on my site load into the table when i click the links for the pages.....


does that make more sense??

MArc
Reply with Quote Reply
Jan 27th 2004#139773 Report
Member since: Mar 24th 2002
Posts: 3114
use a simple include();

As in:
include("includes/".$id.".inc");

And then link to pages with a href='index.php?id=about' <--- that would try and include the file "about.inc" in a folder called "includes".
Reply with Quote Reply
Jan 27th 2004#139780 Report
Member since: Jul 19th 2003
Posts: 810
ok. i think that helped some paavo..... this is the code that i have..... :

[php]switch ($page)
{
case "Upload Pictures":
include("includes/" .?picupload.".inc");
break;[/php]

So... I want that information to go into the table when i click upload pictures.... what should i do? at the moment it just opens a new window saying that the file could not be found??

Marc
Reply with Quote Reply
";
?>
[/php]

The first if ! thingie is just for the variable "id" to be set to "home" in case it's not given a value in the URL from the start. That way, to get a file named "upload_pics.inc" you'd link it like a href='index.php?id=upload_pics'. The echoing of the cell tags is just to give an example, of course. Embed it into your code how you see fit.
Jan 27th 2004#139782 Report
Member since: Mar 24th 2002
Posts: 3114
well, that's a bit of a strange way of doing it, if the only thing passed on is a variable name for each section.
I'd still use something like this:
[php]
if(!$id) $id="home";

echo "
";
include("includes/".$id.".inc");
echo "
Reply with Quote Reply
Jan 27th 2004#139783 Report
Member since: Nov 26th 2001
Posts: 2586
It's needs some fixing upping....

You need to get the $page variable from somewhere, so an example of a link:
[php]
Upload Page
[/php]

[php]
if ( !isset ($_GET['page']) ) {
$page = 'upload';
}else{
$page = $_GET['page'];
}

switch ($page)
{
case 'upload':
include("includes/picupload.inc");
break;
default:
include('includes/default.inc');
}
[/php]

also it helps to set a default page in your case statement.
Reply with Quote Reply
Jan 27th 2004#139784 Report
Member since: Nov 26th 2001
Posts: 2586
or Paavo's Method =)
Reply with Quote Reply
Jan 27th 2004#139785 Report
Member since: Jul 19th 2003
Posts: 810
thanks guys./// will try it soon and hope it works
Reply with Quote Reply
Page: 1 2 Back to top
Please login or register above to post in this forum