我无法同时使用单选按钮。他们不会肩并肩。当他们并排使用时,它会使我的代码下面的复选框混乱。
我尝试使用填充和边距以不同的方式浮动它,尝试调整高度和宽度
<div class="style" style="width 100px; float:left; height 100px; margin:0px;">
<!-- this code asks the suer what clothing style they like. They have a lot of options. The code is like the gender code -->
Select a style: <br />
<label> <input type="radio" name="style" value="Casual"
<?php
if ($_POST['style'] == 'Casual') {
echo "checked";
}
?>
/>Casual</label><br />
<label> <input type="radio" name="style" value="Athletic"
<?php
if ($_POST['style'] == 'Athletic') {
echo "checked";
}
?>
/>Athletic</label><br />
<label> <input type="radio" name="style" value="Vintage"
<?php
if ($_POST['style'] == 'Vintage') {
echo "checked";
}
?>
/>Vintage</label><br />
<label> <input type="radio" name="style" value="Formal"
<?php
if ($_POST['style'] == 'Formal') {
echo "checked";
}
?>
/>Formal</label><br />
<label> <input type="radio" name="style" value="Streetwear"
<?php
if ($_POST['style'] == 'Streetwear') {
echo "checked";
}
?>
/>Streetwear</label><br />
<label> <input type="radio" name="style" value="Rocker"
<?php
if ($_POST['style'] == 'Rocker') {
echo "checked";
}
?>
/>Rocker</label>
</div>
<br />
<?php
if(($_POST['size'] == NULL) && ($_SERVER['REQUEST_METHOD'] == 'POST')){
echo "<strong>Please select a clothing size!</strong><br />";
}
?>
<div class="size" style="width 100px; float:left; height 100px; margin:0px;">
Select a size: <br />
<label> <input type="radio" name="size" value="Extra Small"
<?php
if ($_POST['size'] == 'Extra Small') {
echo "checked";
}
?>
/>Extra Small</label><br />
<label> <input type="radio" name="size" value="Small"
<?php
if ($_POST['size'] == 'Small') {
echo "checked";
}
?>
/>Small</label><br />
<label> <input type="radio" name="style" value="Medium"
<?php
if ($_POST['size'] == 'Medium') {
echo "checked";
}
?>
/>Medium</label><br />
<label> <input type="radio" name="size" value="Large"
<?php
if ($_POST['size'] == 'Large') {
echo "checked";
}
?>
/>Large</label><br />
<label> <input type="radio" name="size" value="Extra Large"
<?php
if ($_POST['size'] == 'Extra Large') {
echo "checked";
}
?>
/>Extra Large</label><br />
<label> <input type="radio" name="size" value="2X Large"
<?php
if ($_POST['size'] == '2X Large') {
echo "checked";
}
?>
/>2X Large</label>
</div>
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<?php
if(($_POST['conf'] == NULL) && ($_SERVER['REQUEST_METHOD'] == 'POST')){
echo "<strong>Please confrim your style and size!</strong><br />";
}
?>
<!-- this checkbox makes the sure the user is satisfied with their selection. They have to select it manually, but it is sticky so if they check it and forget another field it will remain checked -->
Check to confirm your style and size <input type="checkbox" name="conf" value="conf"
<?php
if ($_POST['conf'] == 'conf') {
echo "checked";
}
?>
/>
这是现在的代码:mycode
我希望它们并排出现而不会干扰此代码下方的复选框。
答案 0 :(得分:0)
尝试删除第53行中的<br />
标签,请立即尝试:
<div class="style" style="width 100px; float:left; height 100px; margin:0px;">
<!-- this code asks the suer what clothing style they like. They have a lot of options. The code is like the gender code -->
Select a style: <br />
<label> <input type="radio" name="style" value="Casual"
<?php
if ($_POST['style'] == 'Casual') {
echo "checked";
}
?>
/>Casual</label><br />
<label> <input type="radio" name="style" value="Athletic"
<?php
if ($_POST['style'] == 'Athletic') {
echo "checked";
}
?>
/>Athletic</label><br />
<label> <input type="radio" name="style" value="Vintage"
<?php
if ($_POST['style'] == 'Vintage') {
echo "checked";
}
?>
/>Vintage</label><br />
<label> <input type="radio" name="style" value="Formal"
<?php
if ($_POST['style'] == 'Formal') {
echo "checked";
}
?>
/>Formal</label><br />
<label> <input type="radio" name="style" value="Streetwear"
<?php
if ($_POST['style'] == 'Streetwear') {
echo "checked";
}
?>
/>Streetwear</label><br />
<label> <input type="radio" name="style" value="Rocker"
<?php
if ($_POST['style'] == 'Rocker') {
echo "checked";
}
?>
/>Rocker</label>
</div>
<?php
if(($_POST['size'] == NULL) && ($_SERVER['REQUEST_METHOD'] == 'POST')){
echo "<strong>Please select a clothing size!</strong><br />";
}
?>
<div class="size" style="width 100px; float:left; height 100px; margin:0px;">
Select a size: <br />
<label> <input type="radio" name="size" value="Extra Small"
<?php
if ($_POST['size'] == 'Extra Small') {
echo "checked";
}
?>
/>Extra Small</label><br />
<label> <input type="radio" name="size" value="Small"
<?php
if ($_POST['size'] == 'Small') {
echo "checked";
}
?>
/>Small</label><br />
<label> <input type="radio" name="style" value="Medium"
<?php
if ($_POST['size'] == 'Medium') {
echo "checked";
}
?>
/>Medium</label><br />
<label> <input type="radio" name="size" value="Large"
<?php
if ($_POST['size'] == 'Large') {
echo "checked";
}
?>
/>Large</label><br />
<label> <input type="radio" name="size" value="Extra Large"
<?php
if ($_POST['size'] == 'Extra Large') {
echo "checked";
}
?>
/>Extra Large</label><br />
<label> <input type="radio" name="size" value="2X Large"
<?php
if ($_POST['size'] == '2X Large') {
echo "checked";
}
?>
/>2X Large</label>
</div>
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<?php
if(($_POST['conf'] == NULL) && ($_SERVER['REQUEST_METHOD'] == 'POST')){
echo "<strong>Please confrim your style and size!</strong><br />";
}
?>
<!-- this checkbox makes the sure the user is satisfied with their selection. They have to select it manually, but it is sticky so if they check it and forget another field it will remain checked -->
Check to confirm your style and size <input type="checkbox" name="conf" value="conf"
<?php
if ($_POST['conf'] == 'conf') {
echo "checked";
}
?>
/>