发布价值变动

I have records which column name is counter. And the value is like 000003, 000012, and so on. But my problem is, when I try to post it the value that receive in the form action url change, I receive only 3 which is the real value is 000003. Why is that? I echo POST value in my second page.

<?php
$mysqli = new mysqli("localhost", "root", "", "app");
$result1 = $mysqli->query("
    SELECT *
    FROM app 
");
echo'<table border=1>
        <thead>
    <tr>
        <th>cc</th>
    </tr>
        </thead>';
        echo'<tbody>';
while($row = $result1->fetch_assoc()){
echo'   <tr>';
            echo "<td><a href='#' onclick='javascript:postIt(".$row['counter'].");'>".$row['counter']."</a></td> ";
        echo'</tr>';
    }
    echo "</tbody></table>";

?>
<script>
 function postIt(value){
   document.forms[0].id.value = value;
   document.forms[0].submit();
 }
</script>
<form name="blah" action="check.php" method="post">
<input type="hidden" name="id">
</form>

Why 000003 become only 3, or 000172 become 172. Help?

this may work

echo "<td><a href='#' onclick='javascript:postIt(\"".$row['counter']."\");'>".$row['counter']."</a></td> ";

Because you are working with integers, not string. If you want to keep them as strings, meaning, with the leading zeros, convert the values to string type.

Why is this a problem? At the receiving end you can simply pad the number back out how you want it to.

It seems like a counter should be an integer. You can then pad it out or not if and when you want to.

If you really want to you can pad it out before you send it.

See here: How can I pad a value with leading zeros?