Hello,
I'm trying to write a script that will grab the header, look at any passed variables, and then recreate those variables for the current page. Like this:
.../whatever.php?apple=1&pear=2&orange=3
$apple = 1;
$pear = 2;
$orange = 3;
Then with the same script be able to make this work too:
.../whatever.php?wood=4&pear=2&orange=8
$wood = 4;
$pear = 2;
$orange = 8;
What I'm trying to accomplish is getting rid of having to use 20 if (isset($GET['blabla'])) commands on pages that have a bunch of passed variables. If you need more information let me know. Thanks everyone. Here is the code I am working with now, please excuse all the echo's.
$pass_vars = $_SERVER["argv"];
$x_vars = $pass_vars[0];
echo "<b>x_vars: </b>".$x_vars."<br>";
$x_vars_exploded = explode('&', $x_vars);
echo "<b>x_vars_exploded: </b>".$x_vars_exploded."<br>";
$x_vars_exploded_count = count($x_vars_exploded);
echo "<b>x_vars_exploded_count: </b>".$x_vars_exploded_count."<br>";
echo "<b>Start For Loop</b><br>";
for ($x_vars_i=0; $x_vars_i<$x_vars_exploded_count; $x_vars_i++) {
echo " ".$x_vars_exploded[$x_vars_i]."<br>";
$x_vars_breakout = $x_vars_exploded[$x_vars_i];
$x_vars_breakout_exploded = explode('=', $x_vars_breakout);
$x_vars_breakout_exploded_count = count($x_vars_breakout_exploded);
for ($x_vars_breakout_i=0; $x_vars_breakout_i<$x_vars_breakout_exploded_count; $x_vars_breakout_i++) {
echo " ".$x_vars_breakout_exploded[$x_vars_breakout_i]."<br>";
//Set variables here???
}
}
echo "<b>End For Loop</b><br>";
If you run the script make sure to pass it something or it isn't going to do much... Thanks again.
-Cy