开发者

Hiding text and use Radio button to view it

I am trying to have some content show/appear if a certain radio button (YES) is selected. I have provided the text I have in HTML form. I believe this should be a very simple code but I am VERY rusty on my HTML. This is all within a table. If the YES radio is chosen, I would like the 3 Quantity portions to appears but if not then I would like them hidden. I hope this helps...

<tbody>
<td class="style1" colspan="2">
    <strong>Room Setup<br>
        <tr>
            <span class="style2"><em>Complete where applicable</em></span>
    </strong>
</td>
<td style="width: 255px;">
    *Is a Room Setup Required?
</td>
<td style="width: 202px;">
    <input name="roomsetup" value="yes" type="radio">
    Yes<br>
    <input name="roomsetup" value="no" type="radio">&nbsp; No
</td>
</tr>
<tr>
    <td style="width: 255px; height: 14px;">
    </td>
    <td style="width: 202px; height: 14px;">
        &nbsp;
    </td>
</tr>
<tr>
    <td style="width: 255px;" class="style3">
        Quantity&nbsp;
    </td>
    <td style="width: 202px;">
        <input name="roomchairs" value="yes" type="checkbox">&nbsp; Chairs Needed<br>
        <input name="roomchairsquantity" type="text">
    </td>
</tr>
<tr>
    <td style="width: 255px;">
        &nbsp;
    </td>
    <td style="width: 202px;">
        &nbsp;
    </td>
</tr>
<tr>
    <td style="width: 255px;" class="style3">
        Quantity&nbsp;
    </td>
    <td style="width: 202px;">
        <input name="checktables" value="yes" type="checkbox">&nbsp; Tables Needed<br>
        <input name="roomquantitytable" type="te开发者_如何学Goxt">
    </td>
</tr>
<tr>
    <td style="width: 255px;">
        &nbsp;
    </td>
    <td style="width: 202px;">
        &nbsp;
    </td>
</tr>
<tr>
    <td style="width: 255px;" class="style3">
        Quantity&nbsp;
    </td>
    <td style="width: 202px;">
        <input name="checktableclothes" value="yes" type="checkbox">&nbsp; Tableclothes
        Needed<br>
        <input name="roomquantitycloth" type="text">
    </td>
</tr>
<tr>
    <td style="width: 255px;" class="style3">
        &nbsp;
    </td>
    <td style="width: 202px;">
        &nbsp;
    </td>
</tr>


There are about two ways you can do this.

(1) Using PHP

<?php 

if($_POST["RADIOBOX NAME"] =="OPTION YOU WANT TO SELECT") {
echo "WHAT YOU WANT TO SAY";
//USE THE ECHO AS MUCH AS NEEDED
}
?>

(2) I think that there is a JavaScript for this, however, I am not familiar with JavaScript.


You'll need some javascript for that. If you can use something like jQuery, this is really easy to do, and it's easy to find brazillions tutorial on Internet.

For exemple this one or this one

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜