Forum Moderators: coopster

Message Too Old, No Replies

PHP & SSI

How do I get a variable from SSI to PHP?

         

nzmuso

10:04 pm on Feb 23, 2005 (gmt 0)

10+ Year Member



I'm making a few pages in an existing site that uses SSI includes a lot - and am implementing a mySQL database to show a single articles on a certain page. Hopefully the end result will be to have an 'archive' page, with links to each article, the links being to one .shtml file, and when loaded the shtml file calls a php script which then connects to the mySQL database and does that part of the output.

So.... I'm trying to somehow get a variable from the SSI page into the PHP script. My first thought was to have the links on the archive page look something like

<a href="display.shtml?id=1">Article one</a>
. But I've looked almost everywhere and can't seem to find a way to get that id variable into the php script, which is called with normal SSI
<!--#include virtual="sql.php" -->
.

I realise that QUERY_STRING isn't simply available to the PHP script but there must be some other way to do this. Any ideas?

Elijah

2:10 am on Feb 24, 2005 (gmt 0)

10+ Year Member



Does using the following code give you any usable output related to?id=1 when you call the page and pass a query string like: display.shtml?id=1?

Code:


<?php
echo $_SERVER['QUERY_STRING'].'<br />';
echo $_SERVER['REQUEST_URI'].'<br />';
print_r ($_SERVER['argv']);
?>

nzmuso

5:49 am on Feb 24, 2005 (gmt 0)

10+ Year Member



Don't worry, turns out I can use a PHP page to display the articles after all.