Click to See Complete Forum and Search --> : SHTML's PHP Equiv, plz help...
Ben Rogers
01-30-2004, 08:53 PM
I don't know PHP but I know its very convenient. I want to make a PHP site that can include HTML files like SHTML does, but can use variables (i.e. projep.t35.com/written.php?story=chaos1) is it possible, and if so, how? ;) thx in advance.
Exuro
01-31-2004, 12:56 AM
<?php include($var . ".php"); ?>
I don't know how new you are to PHP, but . (period) is the concatination operator in this language. I know it's kind of strange, I personally hate it, but you learn to deal with it. So the stuff inside the parenthesis above actually means to add the text in $var to the string ".html". This will then include the code from the file with the name $var+".php". I hope that made sense...
Ben Rogers
01-31-2004, 12:00 PM
It didn't, I'm a total PHP n00b.
You need to use the $_GET superglobal to get the variables. In your case, something like this:
$foo = $_GET['story']; # $foo equals chaos1
Ben Rogers
02-01-2004, 08:41 PM
i got help elsewhere and have a system up and running perfectly, as well as a better understanding of php... i'm inspired to learn more.. so... i will.
thanks for the effort :)