I'm trying to make a separate checkbox below another checkbox. I'm making it so the user has to check this separate checkbox to confirm the information.
I tried looking at my code and seeing if I have an error in it. To my knowledge as I'm fairly new, I don't see an error.
<div>
<script
src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js">
</script>
<script>
$(document).ready(function(){
$('input:checkbox').click(function() {
$('input:checkbox').not(this).prop('checked', false);
});
});
</script>
<?php
if(($_POST['style'] == NULL) && ($_SERVER['REQUEST_METHOD'] == 'POST')){
echo "<strong>Please select a style!</strong><br />";
}
?>
What clothing style do you like? <br />
<label> <input type="checkbox" name="style" value="Casual"
<?php
if ($_POST['style'] == 'Casual') {
echo "checked";
}
?>
/>Casual</label><br />
<label> <input type="checkbox" name="style" value="Athletic"
<?php
if ($_POST['style'] == 'Athletic') {
echo "checked";
}
?>
/>Athletic</label><br />
<label> <input type="checkbox" name="style" value="Vintage"
<?php
if ($_POST['style'] == 'Vintage') {
echo "checked";
}
?>
/>Vintage</label><br />
<label> <input type="checkbox" name="style" value="Formal"
<?php
if ($_POST['style'] == 'Formal') {
echo "checked";
}
?>
/>Formal</label><br />
<label> <input type="checkbox" name="style" value="Streetwear"
<?php
if ($_POST['style'] == 'Streetwear') {
echo "checked";
}
?>
/>Streetwear</label><br />
<label> <input type="checkbox" name="style" value="Rocker"
<?php
if ($_POST['style'] == 'Rocker') {
echo "checked";
}
?>
/>Rocker</label><br />
</div>
#this is the checkbox that I want different than the one above
Check to confirm your style <input type="checkbox" name="conf" value="conf"
<?php
if ($_POST['conf'] == 'conf') {
echo "checked";
}
?>
I would like it for my checkbox below to be different than the one above it.
Aucun commentaire:
Enregistrer un commentaire