0
$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>

Edited by mike_2000_17: Fixed formatting

2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by network18
0

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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.