连接不适用于输入提交

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.

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

from what i can see from your html, your designing a calculator. so you want to enter each number assigned to a button into the text field. try this:

html file

 <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="two" value="2">
<input type="submit" name="three" value="3">
</p>
<p>
<input type="submit" name="four" value="4">
<input type="submit" name="five" value="5">
<input type="submit" name="six" value="6">
</p>
<p>
<input type="submit" name="seven" value="7">
<input type="submit" name="eight" value="8">
<input type="submit" name="nine" value="9">
</p>
<p>
<input type="submit" name="plus" value="+"> 
<input type="submit" name="zero" value="0">
<input type="submit" name="minus" value="-">
</p>
</form>

function.php

  <?php

  if (isset($_POST['one'])) {
  $num1 .= $_POST['one'];
  echo $num1;
    }
  if (isset($_POST['two'])) {
  $num2 .= $_POST['two'];
  echo $num2;

  etc...........
       }
 ?>