• 欢迎访问搞代码网站,推荐使用最新版火狐浏览器和Chrome浏览器访问本网站!
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏搞代码吧

php form表单里的判断,该如何解决

php 搞代码 3年前 (2022-01-25) 14次浏览 已收录 0个评论

php form表单里的判断
{{foreach from=$selectAry item=select}}
{{if $select.id == sid}}
{{$select.name}}
{{/if}}
{{/foreach}}
我这里循环输出了但是我让想他输出一个是对应我这个表单里的id的我怎么样做判断,我现在这样的判断一个都输不出来了
如果把判断去了就输出两个

PHP code

<!---ecms Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->                                                             <p style="margin-top:30px">                                             {{foreach from=$selectAry item=select}}                             {{if $select.id == sid}}                                               {{$select.name}}                           {{/if}}                          {{/foreach}}                                                                     </p>                    <div id="isPlist" style="margin-top:4px">                        <p><textarea id='part_text' name="part[text]" cols="28" rows="4" style="padding:3px;font-size:15px;height:90px">输入您的看法,字数在50字内</textarea></p>                    </div>                    <p>                                                                    </p>                
JScript code

<!---ecms Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->function sendData(){    var uid=document.getElementById('hidden_uid').value;    var sid = document.getElementById('hidden_sid').value;    var text = document.getElementById('part_text').value;    var rideo = document.getElementsByName('part[is_good]');    var is_good;    if(text == ''<strong style="color:transparent">来2源gaodaima#com搞(代@码&网</strong><label>搞gaodaima代码</label> || text == '输入您的看法,字数在50字内'){        alert('请提出您的看法,不然投票无效哦!');        return false;    }    alert (sid);    for(var i=0; i<rideo.length;i++){        if(rideo[i].checked == true){            is_good = rideo[i].value;        }    }    var url = 'http://www.h-elab.com/ajax/part/recode.php';    $.getJSON(url,{uid:uid,sid:sid,text:encodeURIComponent(text),is_good:is_good},function(data){        return true;    });}

——解决方案——————–
你给 form 一个唯一标识 嘛
又是 js、又是 jquery 一点团精神都不讲


搞代码网(gaodaima.com)提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请说明详细缘由并提供版权或权益证明然后发送到邮箱[email protected],我们会在看到邮件的第一时间内为您处理,或直接联系QQ:872152909。本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:php form表单里的判断,该如何解决
喜欢 (0)
[搞代码]
分享 (0)
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址