使用php中的选定单选按钮进行多个表单操作

时间:2014-07-05 07:50:20

标签: jquery button radio

<p><h3 style="font-size:18px;">Call Status:</h3>


      <body>

    <div>

        <label><input type="radio" name="colorRadio" <?php if (isset($colorRadio) && $colorRadio=="immediate" ) echo "checked";?>value="IMMEDIATE"> Call Immediate</label>

        <label><input type="radio" name="colorRadio" <?php if (isset($colorRadio) && $colorRadio=="scheduled") echo "checked";?>value="SCHEDULED"> Call Scheduled</label>

        <label><input type="radio" name="colorRadio" <?php if (isset($colorRadio) && $colorRadio=="message") echo "checked";?>value="MESSAGE"> Leave Your Message</label>



    </div>

    <div class="IMMEDIATE box">You have selected <strong>red radio button</strong> so i am here</div>

    <div class="SCHEDULED box"> 
    <p>
    <td>
<input type="Text" id="demo1" name="demo1" maxlength="25" size="25"><a href="javascript:NewCal('demo1','DDMMYYYY',true,24)">
<img src="img/cal.gif" width="16" height="16" border="0"></a>
<span class="descriptions">Pick a Date</span>
    </p>
    </div>

    <div class="MESSAGE box"> 
     <p>
        <label for="textarea" style="font-size:16px; font-weight:700; ">Your Message</label>
        <!--<input id="email" name="email" type="email" class="text" value="" />-->
        <br/><br/><textarea id="text" class="text" name="fmessage" style="FONT-SIZE:10pt" rows="5" cols="35" autocomplete="off"  required></textarea>
     </p>

    </div>


</body>
        </p>

我想执行这样的多个动作,比如每当我选择呼叫立即单选按钮时它会发送到另一个页面..就像在呼叫预定的单选按钮情况下一样,并且还留下你的消息单选按钮...请告诉我怎么做这或请为此提供一些替代方案......

1 个答案:

答案 0 :(得分:0)

快速小提琴......这提供了一种识别colorRadio点击的方法......然后你可以使用if语句来采取必要的行动......

$('input[name=colorRadio]').click(function(){
var status = $('input[name=colorRadio]:checked').val();
alert(status);
});

http://jsfiddle.net/eamonnkillian/P9HWV/

希望这会有所帮助 EJK