changing includes based on user input

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
polosport6699
Forum Commoner
Posts: 35
Joined: Wed Jun 11, 2003 3:19 pm

changing includes based on user input

Post by polosport6699 »

I would like to change the configuration file to select different databases based on user input. I cannot get the variables from the previous page to show up on this page. This code below is the header, I have a form page that has checkboxes with the name db. I send the values to this script but they do not work.....any help?

Code: Select all

global $db;
if ($db=='1') {
$now='iware_config.php'; }
elseif ($db=='2') {
$now='iware_config2.php'; }
else ($db=='3') {
$now='iware_config3.php'; }
	if(isset($ModLoader) && $ModLoader==1)
		{
		include "../../admin/iware_config.php";	
		include "../../admin/gui.php";
		}
	else
		{
		if(isset($ClientLoader) && $ClientLoader==1)
			{
			include "admin/iware_config.php";	
			include "admin/gui.php";
			}
		else
			{
			include "$now";	
			include "gui.php";
			}
		}
SBukoski
Forum Contributor
Posts: 128
Joined: Wed May 21, 2003 10:39 pm
Location: Worcester, MA

Post by SBukoski »

Is the value $db being passed in as a GET or POST variable? Try using $_POST['db'] or $_GET['db'] depending on which method was used. If you echo out the value does it return anything?
Post Reply