$DoCNO=$_POST["DoCNO"];
$NumAt=$_POST["NumAt"];

how to retain my $_POST value when it submitted my myform it seem when submit it will reset the value inside the $DoCNO and $NumAt value

java script:

function testResults (form) {
  var TestVar = form.inputbox.value;
  location.href="PrintMe.php?Result=" + TestVar;
  return false;
  }

my PHP code:

<table width="1060" border="0">
<FORM NAME="myform" onClick="return testResults(this);" method="POST" action="<?php echo $PHP_SELF;?>">
  <tr>
    <td width="130" height="25"><font color='Red'> Desire No.</font><INPUT TYPE="text" size="5" NAME="inputbox" maxlength="2"></td>
    <td width="338"><h3>Project Milestone</h3></td>
    <td width="251"><h3>Remarks </h3></td>
    <td width="323"><h3>Signature/Date</h3></td>
    <input type="text" value="<?=$sbo?>" name="sbo"/>
    <INPUT TYPE="button" NAME="button" Value="Click" onClick="testResults(this.form)">
  </tr>
    </FORM>
</table>
<table width="1060" border="0">
 <?php


        $value = $_GET['Result'];
        for($i=0; $i<$value; $i++)
        {
    ?>
      <tr>
        <td width="333"><input type="text" name="Project[]" size="55"/></td>
        <td width="273"><input type="text" name="remarks[]" size="45"/></td>

    <?   
        echo '<input type="hidden" name="i[]" value='.$i.' />';
        }


  ?>
     <td width="432"></td>
  </tr>

</table>

remove the onclick function from the form and use some button like submit type and leave the action tag as blank, hope this much will make your thing work.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.