| 
	
 | 
 Posted by Jeff on 01/20/07 21:54 
Hey 
 
I'm developing a web site using php 5.2.0 
 
But now I've run into a problem about multiple submit of a form. This web  
page consist of a form and a submit button. 
 
So when the form submit the new data is added to the table, then the php  
script add the id of the new record into hidden field in the form: echo  
"<input type='hidden' name='property' value='".$id."' />"; 
 
But when the user clicks on the refresh button in the browser, then the form  
is submitted again but my hidden field isn't sent. It looks like the browser  
don't care about the values in the form, it just send again the values from  
the last submit. To tryed to fix this problem by manually in the code add  
the $id to the $_POST array: 
$_POST["property"] = $id;  - But that did NOT solved the problem. To me it  
looks like the browser discard the values I manually enter into $_POST.. 
 
Here are some other fixes I tryed but which also FAIL (basically here I try  
to add the $id into the URL) 
if (empty($id)) { 
 echo "<form action='index.php?mode=profile&style=add&opt=1'  
method='post' >"; 
} else { 
 echo "<form  
action='index.php?mode=profile&style=add&opt=1&property=".$id."  
method='post' >"; 
} 
OR 
if (isset($id)) { 
 echo "<form  
action='index.php?mode=profile&style=add&opt=1&property=".$id."  
method='post' >"; 
} else { 
 echo "<form action='index.php?mode=profile&style=add&opt=1'  
method='post' >"; 
} 
 
I believe i can solve this problem if I can get the value of $id sent along  
with the the refresh/submit, but I'm stucked on how.. 
 
Any suggestions? 
 
Jeff
 
  
Navigation:
[Reply to this message] 
 |