dongshu9458 2019-02-18 02:44
浏览 56
已采纳

我的错误消息格式化为我左侧的错误消息

My error message is displayed a bit underneath my other error message. I'm trying to make it so they are displayed next to each other when they get an error. This is what it looks like before the error message: before error This what it looks like when I receive the errors: the error messages. To be more clear I would like the error messages to be above "Select a style:", and "Select a size:"

I tried applying css to format it correctly with margin, I tried adding in spaces. Both did not work.

<?php
if(($_POST['style'] == NULL) && ($_SERVER['REQUEST_METHOD'] == 'POST')){
    echo "<strong>Please select a clothing style!</strong><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">

&nbsp
&nbsp
&nbsp
&nbsp
&nbsp
&nbsp
&nbsp
&nbsp
&nbsp
&nbsp
&nbsp
&nbsp
&nbsp
&nbsp
&nbsp


Select a size: <br />

<label class="one"> <input type="radio" name="size" value="Extra Small" 
<?php 
if ($_POST['size'] == 'Extra Small') {
        echo "checked";
}
?>
/>Extra Small</label><br />

<label class="one"> <input type="radio" name="size" value="Small" 
<?php 
if ($_POST['size'] == 'Small') {
        echo "checked";
}
?>
/>Small</label><br />

<label class = "one"> <input type="radio" name="style" value="Medium" 
<?php 
if ($_POST['size'] == 'Medium') {
        echo "checked";
}
?>
/>Medium</label><br />

<label class="one"> <input type="radio" name="size" value="Large" 
<?php 
if ($_POST['size'] == 'Large') {
        echo "checked";
}
?>
/>Large</label><br />

<label class="one"> <input type="radio" name="size" value="Extra Large" 
<?php 
if ($_POST['size'] == 'Extra Large') {
        echo "checked";
}
?>
/>Extra Large</label><br />

<label class="one"> <input type="radio" name="size" value="2X Large" 
<?php 
if ($_POST['size'] == '2X Large') {
        echo "checked";
}
?>
/>2X Large</label>
</div>

I would like for them to be displayed right next to each other horizontally so it looks nice.

  • 写回答

1条回答 默认 最新

  • dongshuang0011 2019-02-18 04:40
    关注

    Just add table for your error..

    <?php
    if(($_POST['style'] == NULL) && ($_SERVER['REQUEST_METHOD'] == 'POST')){
        echo "<table> <tr> <td> <strong>Please select a clothing style!</strong> </td> </tr> </table>";
    }
    ?>
    
    <?php
    if(($_POST['size'] == NULL) && ($_SERVER['REQUEST_METHOD'] == 'POST')){
        echo "<table> <tr> <td> <strong>Please select a clothing size!</strong></td> </tr> </table>";
    }
    ?>
    
    
    
    <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>
    
    
    
    
    
    
    <div class="size" style="width 100px; float:left; height 100px; margin:0px">
    
    &nbsp
    &nbsp
    &nbsp
    &nbsp
    &nbsp
    &nbsp
    &nbsp
    &nbsp
    &nbsp
    &nbsp
    &nbsp
    &nbsp
    &nbsp
    &nbsp
    &nbsp
    
    
    Select a size: <br />
    
    <label class="one"> <input type="radio" name="size" value="Extra Small" 
    <?php 
    if ($_POST['size'] == 'Extra Small') {
            echo "checked";
    }
    ?>
    />Extra Small</label><br />
    
    <label class="one"> <input type="radio" name="size" value="Small" 
    <?php 
    if ($_POST['size'] == 'Small') {
            echo "checked";
    }
    ?>
    />Small</label><br />
    
    <label class = "one"> <input type="radio" name="style" value="Medium" 
    <?php 
    if ($_POST['size'] == 'Medium') {
            echo "checked";
    }
    ?>
    />Medium</label><br />
    
    <label class="one"> <input type="radio" name="size" value="Large" 
    <?php 
    if ($_POST['size'] == 'Large') {
            echo "checked";
    }
    ?>
    />Large</label><br />
    
    <label class="one"> <input type="radio" name="size" value="Extra Large" 
    <?php 
    if ($_POST['size'] == 'Extra Large') {
            echo "checked";
    }
    ?>
    />Extra Large</label><br />
    
    <label class="one"> <input type="radio" name="size" value="2X Large" 
    <?php 
    if ($_POST['size'] == '2X Large') {
            echo "checked";
    }
    ?>
    />2X Large</label>
    </div>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 HFSS 中的 H 场图与 MATLAB 中绘制的 B1 场 部分对应不上
  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?