donglu2523 2013-02-12 14:34 采纳率: 100%
浏览 36

php比较两个单选按钮中的值

this is one radio button set

<input type="radio" name="image" id="100" value="a"/>
<input type="radio" name="image" id="100" value="b"/>
<input type="radio" name="image" id="100" value="c"/>
<input type="radio" name="image" id="200" value="d"/>
<input type="radio" name="image" id="200" value="e"/>
<input type="radio" name="image" id="300" value="f"/>
<input type="radio" name="image" id="300" value="g"/>
<input type="radio" name="image" id="400" value="h"/>

and so on...

and this is another radio button set

<input type="radio" name="number" value="100"/>
<input type="radio" name="number" value="200"/>200
<input type="radio" name="number" value="300"/>300
<input type="radio" name="number" value="400"/>400
<input type="radio" name="number" value="500"/>500
<input type="radio" name="number" value="600"/>600

my question is how can i compare value of one with value="100" to other with id="100" in php

there is a comparison i want to make but for the field with id = 100 i have values as abcd.. so i cant assign it value = 100 cuz i m saving it in database means.. there are other fields with id=100 but their values shall be diffrent otherwise i m not able to identify them after they are send to databse still i have to do comparison of both.. and that too serverside so what are my options?

more detailed explanation.... there are two sets of radio buttons.. in one set there are values.. and in other sets there are images related to those values.. when user clicks set of value... and user click on set of images so php shall match that image to the value.. if user clicked on 100 as value and later he clicks on an image under the id 200 database shall not allow it to enter and gave him some error

  • 写回答

2条回答 默认 最新

  • dphphvs496524 2013-02-12 15:55
    关注

    Sorry Had to see what your talking about. Help to edit this so to understand your requirement, 'shall match that image to the value'

    <input type="radio" name="image" class="100" value="a_100"/>
    <input type="radio" name="image" class="100" value="b_100"/>
    <input type="radio" name="image" class="100" value="c_100"/>
    <br>
    <input type="radio" name="number" value="100"/>
    <input type="radio" name="number" value="200"/>
    <input type="radio" name="number" value="300"/>
    
    <?php
    
        $image = strstr($_POST['image'],'_'); 
        $number = '_'.$_POST['number'];
    
        if($image == $number) {
            //Do something
        }
    
    评论

报告相同问题?

悬赏问题

  • ¥15 使用ue5插件narrative时如何切换关卡也保存叙事任务记录
  • ¥20 软件测试决策法疑问求解答
  • ¥15 win11 23H2删除推荐的项目,支持注册表等
  • ¥15 matlab 用yalmip搭建模型,cplex求解,线性化处理的方法
  • ¥15 qt6.6.3 基于百度云的语音识别 不会改
  • ¥15 关于#目标检测#的问题:大概就是类似后台自动检测某下架商品的库存,在他监测到该商品上架并且可以购买的瞬间点击立即购买下单
  • ¥15 神经网络怎么把隐含层变量融合到损失函数中?
  • ¥15 lingo18勾选global solver求解使用的算法
  • ¥15 全部备份安卓app数据包括密码,可以复制到另一手机上运行
  • ¥20 测距传感器数据手册i2c