php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #46098 _Post canot asign a variable , only a fixed string
Submitted: 2008-09-16 18:15 UTC Modified: 2008-09-16 18:40 UTC
From: eusebiomarques at hotmail dot es Assigned:
Status: Closed Package: Feature/Change Request
PHP Version: 5.3.0alpha2 OS: centos
Private report: No CVE-ID: None
 [2008-09-16 18:15 UTC] eusebiomarques at hotmail dot es
Description:
------------
the php can not asign the "date_1_fila_".$i  in the _POST argument then i must to write a lot of code to do this 

Reproduce code:
---------------
<?php				
					
if (isset($_GET['action']) && $_GET['action']=="save"){

	for ($i=0;$i<10;$i++){
		echo "post_1=".$_POST["date_1_fila_".$i];
		
                $a="date_2_fila_".$i;
		echo "post_2=".$_POST[$a];

		echo "post_3=".$_POST["date_3_fila_".$i];

	}
}
?>

<form id="form1" name="form1" method="post" action="?action=save">
<label> <div align="center"><input type="submit" name="Submit" value="Salvar todas las rutas" /></div></label>
</form>			
<br>
<br>

<?php
for($i=0; $i<10; $i++) {					
?>

	<input name="date_1_fila_<?php echo $i;?>" value="" type="text" class="textbox" size="10" />
	<input name="date_2_fila_<?php echo $i;?>" value="" type="text" class="textbox" size="10" />
	<input name="date_3_fila_<?php echo $i;?>" value="" type="text" class="textbox" size="10" />

<?php
}
?>

Expected result:
----------------
i spect the result the data in the text field

the php can not asign the "date_1_fila_".$i  in the _POST argument then i must to write a lot of code to do this 

Actual result:
--------------
post_1=post_2=post_3=post_1=post_2=post_3=post_1=post_2=post_3=post_1=post_2=post_3=post_1=post_2=post_3=post_1=post_2=post_3=post_1=post_2=post_3=post_1=post_2=post_3=post_1=post_2=post_3=post_1=post_2=post_3=




Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-09-16 18:40 UTC] eusebiomarques at hotmail dot es
bad code
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Mar 02 06:01:28 2024 UTC