Hi I am trying to get data from a mysql database with php.
These dynamic rows may have multiple prices between 1 and 5.
I would like to use a drop dropdown to display these prices and
allow the user to select the one that apply.
I am having problems getting the dropdown to filter using the "if" statements.
//This works
if ($searching =="yes" && $phrase_count > 0)
{
//search for our search term, in the field the user specified
//search for description and code in bill_ohip_fee_c ode and service
// fee in bill_on_curr_ma ster
$data = mysql_query("SE LECT c.code_id, c.fee_code,
c.description, m.general_fee,
m.technical_fee , m.specialist_fe e,
m.anesthestist_ fee,
m.non_anestheti st_fee
FROM bill_ohip_fee_c ode c, bill_on_curr_ma ster m
WHERE c.fee_code = m.code
AND upper(c.$field) LIKE'%$find%'
AND c.section_code = '$services'
ORDER BY (c.$field)
LIMIT 100");
}
while($row = mysql_fetch_arr ay($data))
{
$code_id = $row['code_id'];
$fee_code = $row['fee_code'];
$description = $row['description'];
$general_fee = $row['general_fee'];
$technical_fee= $row['technical_fee'];
$specialist_fee = $row['specialist_fee '];
$anaesthetist_f ee= $row['anesthestist_f ee'];
$non_anaestheti st_fee= $row['non_anesthetis t_fee'];
//determine length of values
$gen_len = strlen($general _fee);
$tec_len = strlen($technic al_fee);
$spec_len = strlen($special ist_fee);
$ana_len = strlen($anaesth etist_fee);
$non_len =strlen($non_an aesthetist_fee) ;
//format fee to 2 deciaml places
$general = sprintf("%9.2f" ,$general_fee/100);
$technical = sprintf("%9.2f" ,$technical_fee/100);
$specialist = sprintf("%9.2f" ,$specialist_fe e/100);
$anaesthetist = sprintf("%9.2f" ,$anaesthetist_ fee/100);
$non_anaestheti st = sprintf("%9.2f" ,$non_anaesthet ist_fee/100);
/************dro p down not filtering****** *******/
//this is not working
//this is the dropdow box info put into an array for use use below
$fee = "<select name=\"fee[]\">
if($gen_len > 0)
{
<option value = $general> $general</option>
}
if($tec_len > 0)
{
<option value = $technical> $technical</option>
}
if($spec_lent > 0)
{
<option value = $specialist> $specialist</option>
}
if($ana_len > 0)
{
<option value = $anaesthetist> $anaesthetist</option>
}
if($non_len > 0)
{
<option value = $non_anaestheti st> $non_anaestheti st</option>
}
</select>";
//this works
//diaplay search results in rows
echo"<tr height=\"10\">
<td width=\"4%\" bgcolor=\"#fff8 dc\" align=\"center\ "><input
type=\"checkbox \" name=\"fee_choi ce[]\" value=\"$code_i d\"></td>
<td width=\"6%\" bgcolor=\"#fff8 dc\"><span
class=\"style20 "><strong>$fee_ code</strong></span></td>
<td width=\"3%\" bgcolor=\"#eeee e0\" height=\"10\">
<input type=\"text\" name=\"fee_unit[]\" size=\"1\" maxlength=\"2\"
value =\"$fee_unit\ "/></td>
<td width=\"80%\" bgcolor=\"#eeee e0\" class=\"style20 \"> $description
</td>
<td width=\"5%\" align=\"left\"> $fee </td>\n";
echo"</tr>\n";
}