doufang6268 2015-07-26 15:10
浏览 5

连接不适用于输入提交

the variable $res stock just the last submit input clicked. it must stock all submit values which i clicked in.

  <html>
<head></head>
<body>
<form method="post" action="">
<p><input type="text" name="textbox" size="13" readonly></p>
<p>
<input type="submit" name="one" value="1">
<input type="submit" name="one" value="2">
<input type="submit" name="one" value="3">
</p>
<p>
<input type="submit" name="one" value="4">
<input type="submit" name="one" value="5">
<input type="submit" name="one" value="6">
</p>
<p>
<input type="submit" name="one" value="7">
<input type="submit" name="one" value="8">
<input type="submit" name="one" value="9">
</p>
<p>
<input type="submit" name="operation" value="+"> 
<input type="submit" name="one" value="0">
<input type="submit" name="operation" value="-">
</p>
</form>

php code :

<?php       
$res="";

        if(isset($_POST['one']))
        { 
         $val = $_POST['one'];

         $res.=$val;
         echo $res;

        }

?>
    </body>
    </html>

concatenation doesn't work on input submit, $res stock just a value of one input.

  • 写回答

2条回答 默认 最新

  • dongmeng1402 2015-07-26 15:11
    关注

    if u want to concatenate something it goes like

    $res = "something"; $res .= $_POST['one']

    .= concatenates strings .. what you are doing is that you are assigning the value to the string, so whatever is inside will be replaced by the $_POST['one'] value

    评论

报告相同问题?

悬赏问题

  • ¥15 2024-五一综合模拟赛
  • ¥15 下图接收小电路,谁知道原理
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭