Perhaps you can help me with another problem, exploding the array. I checked the manual to do the following:
$rses = explode(",", $ses['res'], -1);
for ($i=0; $i <=count($rses); $i++) {
echo $rses[$i];
}
The output was good, ie: bis, mcep, ...
However, when I passed these values into a function (located on an include page, I recieved some strange responses.
This is how I called the function: (test.php)
for ($i=0; $i <=count($rses); $i++) {
$r1 = res_selection($rses[$i]);
$r2 = res_selection($rses[$i]);
$r3 = res_selection($rses[$i]);
$r4 = res_selection($rses[$i]);
$r5 = res_selection($rses[$i]);
$r6 = res_selection($rses[$i]);
$r7 = res_selection($rses[$i]);
}
and this is the function: (myfunc.php)
function res_selection($rses) {
if ($rses == "bis") {
$r1 = "selected";
return $r1;
}
if ($rses == "cs") {
$r2 = "selected";
return $r2;
}
//and so on ...
If I echo the $rses on the function page (myfunc.php), I get something like: "bis cs cte" which tells me the values of $rses are being passed. Currently, the response I get is $r1="" and $r2="", whereas they both should ="selected". The thing is if I change this:
if ($rses == "bis") {
to this:
if ($rses = "bis") {
(for all of the 'if's')
Then suddenly all $r values ="selected" regardless of the value of $rses. It doesn't seem to be differentiating between the different string values of $rses. After exploding an array, do the values need to be redefined some how?