I am passing variable such as page.php?id=100 to a php script.
When I run the script with the id hard coded it works. It uses x template and displays information in the database just fine. It is just that I need to reprode this script times 21 and dont want to have 21 copies of the same script on the server. I need to be able to pass the variable and an id to the script so that I can use one script to do the job. I will also be using the same form 21 times. I just need the PHP to recognize the difference between the id's I pass to it for each page.
Here is the script.
<?php
include "../xtemplate/xtemplate.class.php";
include "../include/error.inc";
set_error_handler("errorHandler");
// Create a new XTemplate
$xtpl = new XTemplate ("templates/pagesForm.htm");
// Open a connection to the database
if (!($connection = @mysql_pconnect($hostName,
$username,
$password)))
die("Could not connect to the database");
if (!mysql_select_db($databaseName, $connection))
showerror();
// Run the query and get the result
if (!($result = @ mysql_query ("SELECT *
FROM pages
WHERE pageid = $pageid", $connection)))
showerror();
// There is only one matching row
$row = @mysql_fetch_array($result);
// Assign the page data to the template
$xtpl->assign("PAGES", $row);
// Parse the template data
$xtpl->parse("main.pages");
// Parse the whole document
$xtpl->parse("main");
// Output the information to the page
$xtpl->out("main");
?>