1
First of all sorry for my English
Im a php/xoops coding newbie..i'm currently testing
doing a simple module for XOOPS cms...
i'm having trouble with this can anyone help me
ok i have this
two table
info_unit : log_id, occupation
myocc : id, occ_list
input
<select name='occupation'> <option value="">Select Occupation</option> <?php global $xoopsDB; $result = mysql_query("SELECT * FROM ".$xoopsDB->prefix("myocc").""); while($row = mysql_fetch_array($result)) { $occ_list=$row['occ_list']; echo "<option value='$occupation'>$occ_list</option>"; } ?> </select>
the above code working properly...the drop down will display value from myocc..
and the value is submitted to info_unit table successfully
the problem is this code below when i want to edit a record in the edit form the value that i selected in the input form is not display/choosen
update record
<?php $log_id=$_POST[log_id]; if($log_id=='') { echo "<center>Please Select a record</center><br /><br />"; } else { $result = mysql_query("SELECT * FROM info_unit WHERE log_id=$log_id"); while($row = mysql_fetch_array($result)) { $log_id=$row['log_id']; $occupation=$row['occupation']; } ?> <select name='occupation'> <option value=''>Select occupation</option> <?php global $xoopsDB; $result = mysql_query("SELECT * FROM ".$xoopsDB->prefix("myocc").""); while($row = mysql_fetch_array($result)) { $occ_list=$row['occ_list']; if($occupation == '$occ_list') { echo "<option value='$occupation' selected>$occ_list</option>"; } else { echo "<option value='$occupation'>$occ_list</option>"; } } ?> </select>