I have a html page with a drop menu
select name=color
(....a list of colors)
I select the color to be blue.
in my php code I have[code=php]
<?php
$color = $_POST["color"]; //$color = blue from form
if($color=="blu e") $amount=100;
if($color=="gre en") $amount=90;
$total = $amount * 2;
echo $total;
?>[/code]
[Please use CODE tags when posting your source code. Thanks! --pbmods]
I get no value for total.
If I initialize $value=3; before the if statement:
[code=php]
<?php
$color = $_POST["color"]; //$color = blue from form
$value=3;
if($color=="blu e") $amount=100;
if($color=="gre en") $amount=90;
$total = $amount * 2;
echo $total;
?>[/code]
I get a value for total to be 6.
PLEASE HELP
select name=color
(....a list of colors)
I select the color to be blue.
in my php code I have[code=php]
<?php
$color = $_POST["color"]; //$color = blue from form
if($color=="blu e") $amount=100;
if($color=="gre en") $amount=90;
$total = $amount * 2;
echo $total;
?>[/code]
[Please use CODE tags when posting your source code. Thanks! --pbmods]
I get no value for total.
If I initialize $value=3; before the if statement:
[code=php]
<?php
$color = $_POST["color"]; //$color = blue from form
$value=3;
if($color=="blu e") $amount=100;
if($color=="gre en") $amount=90;
$total = $amount * 2;
echo $total;
?>[/code]
I get a value for total to be 6.
PLEASE HELP
Comment