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
https://forums.phpfreaks.com/topic/16188-including-contents-of-strings/
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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.