totally stumped...
| From: | Brian V Bonini | Date: | Fri, 16 May 2003 21:37:07 +0000 |
| Subject: | totally stumped... | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-147980@lists.php.net to get a copy of this message | ||
I must be brain fried and not seeing it but....
Why does this :
for($i = 1; $i <= 2.1; $i += 0.1) {
$p_val[] = $i;
}
print_r($p_val);
echo "Protien (pr/kg/bodyweight):\n";
echo '<select name="protein">'."\n";
foreach($p_val as $value) {
$str = ($value != $_POST['protein']) ? "<option
value=\"$v\">" .
sprintf("%.1f", $v) . "g</option>" : "<option
value=\"$v\"
selected=\"selected\">" . sprintf("%.1f", $v) .
"g</option>";
echo $str ."\n";
}
echo "</select>\n";
fill the select box up with 1000.0g ??
print_r() returns:
Array
(
[0] => 1
[1] => 1.1
[2] => 1.2
[3] => 1.3
[4] => 1.4
[5] => 1.5
[6] => 1.6
[7] => 1.7
[8] => 1.8
[9] => 1.9
[10] => 2
)
if I change $value to $v it's ok but if it's
anything other then $v it wigs out, what kind
of sense does that make?