Question: Repopulating form parameters

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I'm hoping that this question will be more succinct.
I am trying to repopulate a search form with a user's
chosen paramters.  I am running into a problem with
"multiple select lists"

First , this is the element when the form is first
presented to the user:

<select name="Ind[]" size="8" multiple="multiple"
id="Ind[]" >
<?php while($row = mysql_fetch_array($inds,
YSQL_BOTH)) { echo '<option
value="'.$row['CareerIDs'].'">'.$row['CareerCategories'].'</option>';
}
?>

So the element's option are taken from a table. 

Now I am grabbing the array and can print out the
chosen values correctly, either using an implode:

if (count($Ind) > 0 AND is_array($Ind)) {
    $Ind = "'".implode("','", $Ind)."'";
}

or a "for" loop:

if (isset($Ind)) {
$j = count($Ind);
for($i=0; $i<$j; $i++)
print_r($Ind[$i]);
}

What I can't do is getting the options that were
chosen to be highlighted in the select list.  
i.e if there are 5 options for user to choose from:
1-Banking 2-Arts 3-I.T. 4-Accounting 5-Retail

And user chooses 1-Banking and 5-Retail, when I
reapply the query string I want those 2 to be
highlighed in the options list.  
It is working fine for textfield.  

?Ind%5B%5D=1&Ind%5B%5D=2&JTitle=&City=Bronx&Days=&Recs=15&Submit=Submit

If I apply the above query string, Bronx will be
populated in the City<textfield>
Not so, with the Ind[] array.

Anyone know what I am talking about ?

Stuart

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux