Ich habe einen Code. Irgendwie ist es nur möglich, das letzte verborgene Eingabe-Namensfeld anstelle des anderen zu wählen. Ich habe auch versucht, wenn und sonst, aber nichts wird angezeigt. Bitte beraten.Wie unterscheidet man Namen in PHP
Ohne die sonst wenn Fälle Szenario:
HTML:
<div class="tab-label">
<input type="radio" id="ldktech_product_good" name="conditition" value="good" >
<input type="hidden" id="ldktech_product_price_good" name="price" value="7.50">
<label for="ldktech_product_good">Good</label>
HINWEIS: Bitte nehmen Sie das Ladegerät mit Ihrem iPad Trade-in oder eine Ersatzgebühr wird vom Angebot abgezogen
<div class="tab-label">
<input type="radio" id="ldktech_product_flawless" name="conditition" value="flawless" >
<input type="hidden" id="ldktech_product_price_flawless" name="price" value="10">
<label for="ldktech_product_flawless">Flawless</label>
PHP:
$condition = $_POST["conditition"];
$price = $_POST["price"];
echo $price;
echo "<br>";
echo $condition;
Mit den else if-Szenarien:
HTML-Code:
<div class="tab-label">
<input type="radio" id="ldktech_product_good" name="conditition" value="good" >
<input type="hidden" id="ldktech_product_price_good" name="price-good" value="7.50">
<label for="ldktech_product_good">Good</label>
<div class="tab-label">
<input type="radio" id="ldktech_product_flawless" name="conditition" value="flawless" >
<input type="hidden" id="ldktech_product_price_flawless" name="price-flawless" value="10">
<label for="ldktech_product_flawless">Flawless</label>
PHP-Code:
$condition = $_POST["conditition"];
if($condition == "good"){
$price = $_POST["price-good"];}
else if ($condition == "flawless"){
$price = $_POST["price-flawless"];}
echo $price;
echo "<br>";
echo $condition;
Nichts Arbeit. Bitte empfohlen
Sie müssen möglicherweise durch den Code gehen und Ihre Rechtschreibung überprüfen, da Sie "Bedingung" hier falsch geschrieben: $ _POST [ "conditition"] – slevy1