| 
	
 | 
 Posted by fiziwig on 06/10/23 11:43 
You have it structured as if you expect it to wait for the form the 
first time through. Remember, the first time the page is displayed 
there is no input, so ALL the php ont the page will be executed, but 
there will be no data for it to work on. Only AFTER the user clicks the 
submit button and THE PAGE IS RELOADED will the data be available. 
 
Most often, code to process the data is put before the table itself 
since you will need to get that data THE SECOND TIME THROUGH to make 
the form entries sticky. 
 
For example: 
 
<? 
  if (isset($_POST['submitted'])) { 
    $input_value=$_POST['stuff']; 
  } 
?> 
<FORM ACTION="thispage.php" METHOD='post'> 
  <INPUT TYPE='text' name="stuff" VALUE="<? echo $input_value;?>"> 
  <INPUT TYPE="hidden" NAME="submitted" VALUE="TRUE"> 
  <INPUT TYPE="submit" VALUE="DO IT"> 
</FORM> 
 
Notice that by picking the value out of the $_POST array before you get 
to the FORM tage then the value that was entered in the form THE FIRST 
TIME THROUGH, gets stuck in as the default value in the form THE SECOND 
TIME THROUGH. 
 
--gary
 
  
Navigation:
[Reply to this message] 
 |