Hallo,
ich hab folgendes Problem:
Bei dem untenstehenden Formular werden die Radiobuttons irgendwie nicht mitabgeschickt, wenn das Formular abgeschickt wird:
PHP
<?php
session_start();
error_reporting(E_ALL | E_STRICT);
mysql_connect("localhost", "root", "");
mysql_select_db("ziege");
$_SESSION["time"] = (isset($_SESSION["time"])) ? $_SESSION["time"] : 0;
if (isset($_GET["reload"]) && $_GET["reload"] != $_SESSION["time"]) {
$_SESSION["time"] = $_GET["reload"];
print_r($_GET);
}
?>
<!DOCTYPE html>
<html>
<head>
<title>Unwahrscheinlich wahrscheinlich</title>
<meta charset="UTF-8" />
<meta name="description" content="" />
<meta name="author" content="" />
<meta name="keywords" content="" />
<script src="../js-lib/jQuery1.5/jQuery.js"></script>
<script src="../js-lib/jQueryUI/js/jquery-ui-1.8.10.custom.min.js"></script>
<link href="../js-lib/jQueryUI/css/ui-lightness/jquery-ui-1.8.10.custom.css" />
<script>
var right = Math.floor(Math.random() * 3 + 1);
$(document).ready(function () {
$("#rowtwo").hide();
$("#success").hide();
$("#spiel").submit(function () {
$("#right").val(right);
});
$('#rowone input[type="radio"]').change(function () {
var one = $('#rowone input[type="radio"]'), selectone = one.attr("disabled", "disabled").filter(":checked").val(), hide = 0;
if (selectone == right) {
var a = [];
if (selectone == 1) {
a = [2, 3];
} else if (selectone == 2) {
a = [1, 3];
} else if (selectone == 3) {
a = [1, 2];
}
hide = a[Math.floor(Math.random() * 2)];
} else {
hide = 1;
while (hide == selectone || hide == right) {
++hide;
}
}
$("#b" + hide).detach();
$("#rowtwo").fadeIn(1000);
});
$('#rowtwo input[type="radio"]').change(function () {
var two = $('#rowtwo input[type="radio"]'), selecttwo = two.attr("disabled", "disabled").filter(":checked").val(), message = "Du hast leider eine Ziege erhalten!";
if (selecttwo == right) {
message = "Du hast das Auto gewonnen!";
}
window.setTimeout(function () {
}, 3000);
$("#success").html(message + "<br />Dein Ergebnis wird in Kürze eingetragen!").fadeIn(1000);
});
});
</script>
<style type="text/css">
.formlist {
list-style-type: none;
}
</style>
</head>
<body>
<div id="wrapper">
<form action="ziege.php" method="get" id="spiel">
<input type="hidden" name="reload" value="<?php echo time(); ?>" />
<input type="hidden" name="right" value="0" id="right" />
<div id="rowone">
<ul class="formlist">
<li><input type="radio" name="first" value="1" /> Box 1</li>
<li><input type="radio" name="first" value="2" /> Box 2</li>
<li><input type="radio" name="first" value="3" /> Box 3</li>
</ul>
</div>
<div id="rowtwo">
<ul class="formlist">
<li id="b1"><input type="radio" name="second" value="1" /> Box 1</li>
<li id="b2"><input type="radio" name="second" value="2" /> Box 2</li>
<li id="b3"><input type="radio" name="second" value="3" /> Box 3</li>
</ul>
</div>
<div id="success">
</div>
</form>
</div>
</body>
</html>
Alles anzeigen
DerWaldschrat
edit: Ich hab grad gemerkt, dass es irgendwie mit dem Submit-Handler zusammenhängt, und hab ein Workaround gefunden, aber warum passiert es, dass die Radios nicht mitgeschickt werden?