dongrao9454 2016-06-27 08:53 采纳率: 100%
浏览 28

如何使用PHP计算div中存在的文本框的数量

I need one help.I have multiple text field inside a div and i need to count those using PHP.I am explaining my code below.

  <div class="questionshowp">
        <input name="optional_0_0_ans" id="optional_0_0_ans" class="form-control firstsec" placeholder="Text, Image URL, or LaTeX" value="" type="text">
     <input name="optional_0_1_ans" id="optional_0_1_ans" class="form-control firstsec" placeholder="Text, Image URL, or LaTeX" value="" type="text">
     <input name="optional_0_2_ans" id="optional_0_2_ans" class="form-control firstsec" placeholder="Text, Image URL, or LaTeX" value="" type="text">
    </div>
<?php

?>

Here 3 input fields are present inside a div.Here i need to echo how many nos of field is present using PHP.Please help me.

  • 写回答

2条回答 默认 最新

  • dpdhf02040 2016-06-27 08:57
    关注

    Keep a flag $count and increment inside the for loop

    $count = 0;
    
    for loop {
    $count++
    }
    echo $count;
    

    or

    $count = count($listValue);

    评论

报告相同问题?

悬赏问题

  • ¥15 用C语言输入方程怎么
  • ¥15 网站显示不安全连接问题
  • ¥15 github训练的模型参数无法下载
  • ¥15 51单片机显示器问题
  • ¥20 关于#qt#的问题:Qt代码的移植问题
  • ¥50 求图像处理的matlab方案
  • ¥50 winform中使用edge的Kiosk模式
  • ¥15 关于#python#的问题:功能监听网页
  • ¥15 怎么让wx群机器人发送音乐
  • ¥15 fesafe材料库问题