-
PHP Help...
Im working on a new site and I want to have a few tutorials.... But instead of having to link each chapter of the tutorial to a different URL I want to have a PHP script that will do it (in other words instead of linking to page2.html the script would be apache.php?page2) is this possible? I heard someone saying its Sectio0ns or something....
Thanks in advance
-
This works for me. In your example, your apache.php should have this content:
Code:
<?php
header("location: page".$_GET["chapter"].".html");
?>
If you now go to this page: apache.php?chapter=3
you will end up showing: page3.html
There's a working example here: http://80.60.89.26/~guus/apache.php
http://80.60.89.26/~guus/apache.php?chapter=3 will bring you to page3.html
I'm pretty new to php, so I'm not quite sure how this affect site security. Basically, you are giving users the opportunity to insert variables, so that can't be very good... :)
Note that surfing to http://80.60.89.26/~guus/apache.php tries to forward you to page.html, since there isn't a variable 'chapter'. You could make your homepage/index here.