[FX.php List] select field from value list

Gjermund Gusland Thorsen ggt667 at gmail.com
Fri Jul 14 11:44:07 MDT 2006


Take a look at this from a post last week:

<?
foreach( $vlResult['valueLists']['categories'] as $key => $value ) {
       if( $value == $itemData['Category'][0] ) {
               $sel = 'selected';
       } else {
               $sel = '';
       }
       $vlCategoryOptions[] = '<option value="'. $value . '" '.$sel.'>';
}

$vlCategory = '<select name="Category">'
       . implode( "\n", $vlCategoryOptions )
       . '</select>';
?>

On 7/14/06, Jane Chinn <Jane.Chinn at cwu.edu> wrote:
>
> Hi,
>
> I would like to be able to bring up an edit page with a pre-existing
> value from the database that can be edited in the same value list
> being displayed.
>
> This is what I have but it won't show the existing value from the DB
> and won't update the DB.  All the other edit fields update, however.
>
> // In head of page:
>
> <?php
> include_once('../FX/FX.php');
> include_once('../FX/FMErrors.php');
> include_once('../FX/server_data.php');
>
> $recid=$_GET[recid];
>
> $search=new FX($serverIP,$portNumber);
> $search->SetDBData('MTISvideos.fp7','Layout1');
> $search->AddDBParam('-recid',$recid);
>
> $searchResult=$search->FMFind();
> /* $searchData = current($searchResult['data']); */
> foreach($searchResult['data'] as $key=>$searchData);
>
> $v1=new FX($serverIP,$portNumber);
> $v1 -> SetDBData('MTISvideos.fp7','Layout1');
> $v1Result = $v1 -> FMView();
>
> ?>
>
> // In a table in same page with edit fields
>
>      <td align="right"><strong>Category:</strong></td>
>      <td><select name="category">
>                 <?php
>                 foreach($v1Result['valueLists']['CATEGORY'] as $key => $value)
>                 {
>                 if ($searchData['real_video_new::category'][0]==$value) {
>                 $selected = 'selected';
>                 }else{
>                 $selected ='';
>                 }
>                 ?>
>
>                 <option value="<?php echo $value; ?>"<?php echo $selected; ?>><?php
> echo $value; ?></option>
>                 <?php
>
>                 }
>
>                 ?>
>                 </select>
>
>      </td>
>
> Thanks for helping with my somewhat annoying questions.
>
> Jane
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list
>


More information about the FX.php_List mailing list