i'm having a problem printing the 'selected' property in the 'option' tag...
here's a snippet of my code:
<tr>
<td>To : </td>
<td>
<?php
$get_GE = "SELECT * FROM tbl_portal_user WHERE access_title = \"Faculty\" AND department = \"GE\"";
$result_GE = $database->query($get_GE);
echo "<br /> General Education:<br />";
?>
<select style="width:200px;" name="faculty[]" size="4" multiple="multiple">
<?php
$to2=$to;
while($select_GE = $database->fetch_array($result_GE))
{
if(!isset($to)){
echo "<option value={$select_GE['id']}>{$select_GE['first_name']} {$select_GE['last_name']}";
}
else{
$key = explode(",",$to);
for($l=0;$l<=count($key);$l++){
if(strcmp($key[$l],(string)$select_GE['id'])==0){
echo "<option selected value={$select_GE['id']}>{$select_GE['first_name']} {$select_GE['last_name']}";
break;
}
else{
echo "<option value={$select_GE['id']}>{$select_GE['first_name']} {$select_GE['last_name']}";
break;
}
}
}
}
?>
</select>
</td>
<td>
<?php
$get_IT = "SELECT * FROM tbl_portal_user WHERE access_title = \"Faculty\" AND department = \"IT\"";
$result_IT = $database->query($get_IT);
echo "<br /> Information Technology:<br />";
?>
<select style="width:200px;" name="faculty[]" size="4" multiple="multiple">
<?php
while($select_IT = $database->fetch_array($result_IT))
{
if(!isset($to2)){
echo "<option value={$select_IT['id']}>{$select_IT['first_name']} {$select_IT['last_name']}";
}
else{
$key2 = explode(",",$to2);
for($k=0;$k<=count($key2);$k++){
if(strcmp($key2[$k],(string)$select_IT['id'])==0){
echo "<option selected value={$select_IT['id']}>{$select_IT['first_name']} {$select_IT['last_name']}";
break;
}
else{
echo "<option value={$select_IT['id']}>{$select_IT['first_name']} {$select_IT['last_name']}";
break;
}
}
}
}
?>
</select>
</td>
</td>
</tr>
what happens is when i saved the selected 2 different options, the values are saved in '$to', they are joined. when i tried to explode the string and turned it on an array, i think it does not enter the second 'select' tag.
thanks in advance for the help...

New Topic/Question
Reply




MultiQuote






|