Jump to content

Including contents of strings?


Adastra

Recommended Posts

I have a document structured like this:
[code=php:0]<?
if ($_GET['p'] == "name1") {
my contents
} elseif ($_GET['p'] == "name2") {
my contents
} elseif ($_GET['p'] == "name3") {
my contents
}
?>[/code]
and so on.

But now I need a string which gives me the contents of two of those strings, which somewhat includes the content of two of the strings in a new one together.
[code=php:0]elseif ($_GET['p'] == "name_all") {
content of name2 and name3
}[/code]

How can I do that? include() doesn't work, and I've tried various other stuff with echo, $_GET and print, but nothing works! I'm sure you can easily do this with some function I don't know about.

Thanks in advance :)
Link to comment
Share on other sites

This would work perfectly
I get wat you mean
[code]
elseif ($_GET['p'] == "name_all")
{
include("$_SERVER[SCRIPT_FILENAME]?p=name2");
include("$_SERVER[SCRIPT_FILENAME]?p=name3");
}
[/code]

See its simple if you use get to get the content you can include the same script with different get parameters.
:)
hope dat helps
Link to comment
Share on other sites

Hmmpf, it's not working, I get this error (multiple times):
Warning: main(): Failed opening '/var/www/index.php?p=page3' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/unisys-outsourcing/index.php on line 5
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.