下面的代码在 php 5.3 下生成一个Notice: Undefined index: waehrungbep。随着error_reporting(^^E_NOTICE)
我压制了消息。但是我怎样才能修复代码而不是取消通知?
<label for="WährungBEP" class="label"></label>
<select name="waehrungbep" id="waehrungbep" title="Waehrung wählen." onChange="return recalc()">
<option value="1.22" <?php if($_POST['waehrungbep'] == "1.22") { echo "selected=\"selected\""; }; ?>selected >EUR</option>
<option value="1" <?php if($_POST['waehrungbep'] == "1") { echo "selected=\"selected\""; }; ?>>CHF</option>
<option value="0.95" <?php if($_POST['waehrungbep'] == "0.95") { echo "selected=\"selected\""; }; ?>>$</option>
</select>