[FX.php List] select field from value list Solved

Jane Chinn Jane.Chinn at cwu.EDU
Fri Jul 14 14:55:55 MDT 2006


Gjermund,

You are kind to have replied to my message.  I tweaked and diddled in  
the most unscientific manner until I finally removed an input field:

<input type="text" size="50" name="category" value="<?php echo  
$searchData['real_video_new::category'][0]; ?>">

that had the same field as the select.  Obviously, you can't do that  
(I realize now).

After I removed it the original code I was using worked just fine:

   <?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
		
		}
		
		?>



On Jul 14, 2006, at 10:44 AM, Gjermund Gusland Thorsen wrote:

> 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
>>
> _______________________________________________
> 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