Let's see..
<!DOCTYPE html>
<html lang="en">
<head>
<title>Prefill Data Radio Button</title>
</head>
<body>
<form action="<?php $_SERVER['PHP_SELF'];?>"method="post">
Jenis Kelamin
<input type="radio" name="sex" value="Pria" checked
<?php
if (isset($_POST['sex']) and $_POST['sex'] == 'Pria') {
echo 'checked="checked"';
}
?>
/>Pria
<input type="radio" name="sex" value="Wanita"
<?php
if ($_POST['sex'] == 'Wanita') {
echo 'checked="checked"';
}
?>
/>Wanita <br />
<input type="submit" value="ok" />
</form>
<?php
if (isset($_POST['sex'])) {
echo $_POST['sex'];
}
?>
</body>
</html>
The result is...
Let's try.... :D
Tidak ada komentar:
Posting Komentar