PHP货币转换器不工作

时间:2016-07-02 19:18:18

标签: php

对于任何高级PHP用户,我都是Begginer。所以,我正在使用这个PHP货币转换器:

<!DOCTYPE html>
<html>
    <head>
        <title>Currency Converter</title>
    </head>
    <body>
        <h1>Currency Converter</h1>
        <form action="index.php" method="get">
            <input type="text" name="input" placeholder="Enter Amount"></input>
            <select name="dropdown">
                <option value="USD">US Dollar (USD)</option>
                <option value="GDP">Great British Pound (GDP)</option>
                <option value="EUR">Euro (EUR)</option>
            </select>
            <br />
            <input type="text" value="<?php echo @$output; ?>" disabled>
            <select name="odropdown">
                <option value="USD">US Dollar (USD)</option>
                <option value="GDP" selected>Great British Pound (GDP)</option>
                <option value="EUR">Euro (EUR)</option>
            </select>
            <br />
            <input type="submit" name="sbmt" value="Convert!"></input>
        </form>
    </body>
</html>
<?php

$cc_input = $_GET['input'];
$cc_dropdown = $_GET['dropdown'];
$cc_odropdown = $_GET['odropdown'];

if(isset($_GET['smbt']))
{
    if($cc_dropdown == 'USD') {
        if($cc_odropdown == 'USD') {
            $output = $cc_input * 1;
            echo $output;
        } elseif($cc_odropdown == 'EUR') {
            $output = $cc_input * 0.897748;
            echo $output;
        } elseif($cc_odropdown == 'GDP') {
            $output = $cc_input * 0.753608;
            echo $output;
        }
    }
    elseif($cc_dropdown == 'EUR') {
        if($cc_odropdown == 'USD') {
            $output = $cc_input * 1.11390;
            echo $output;
        } elseif($cc_odropdown == 'EUR') {
            $output = $cc_input * 1;
            echo $output;
        } elseif($cc_odropdown == 'GDP') {
            $output = $cc_input * 0.83944;
            echo $output;
        }
    }
    elseif($cc_dropdown == 'GDP') {
        if($cc_odropdown == 'USD') {
            $output = $cc_input *   1.32695;
            echo $output;
        } elseif($cc_odropdown == 'EUR') {
            $output = $cc_input * 1.19127;
            echo $output;
        } elseif($cc_odropdown == 'GDP') {
            $output = $cc_input * 1;
            echo $output;
        }
    }
}
?>

当我尝试并点击转换时!什么都没有发生?在开发人员服务器中内置的php也没有错误。它只是说绿色的/index.php?input=1&dropdown=USD&odropdown=GDP&sbmt=Convert%21。

0 个答案:

没有答案