Re: Array problem
| From: | listas@uakari.com | Date: | Sat, 26 Mar 2005 15:26:53 +0000 |
| Subject: | Re: Array problem | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-211618@lists.php.net to get a copy of this message | ||
May be this help you:
$data=$_POST['position'];
$positions=array_keys($data);
foreach($positions as $pos){
$row=$data[$pos];
foreach($row as $value){
$sql="INSERT INTO table_name (field_name)VALUES ('$value')";
$cursor=mysql_query($sql);
}
}
Devta.
virtualsoftware@gmail.com escribió:
Hi, I have a form like this: <form action="products.php" method="post"> <input name="position[pos][value 1]" type="text" id="position[pos][value 1]" value="number 1"> <input name="position[pos][value 2]" type="text" id="position[pos][value 2]" value="number 2"> <input name="position[pos][value 3]" type="text" id="position[pos][value 3]" value="number 3"> </form> For each element of the array i want to update the value in the database. For example, for position[pos][value 1] i want to update the value (number 1) in the database. Thanks in advance for your help!!! ------------------------------------------------------------------------ No virus found in this incoming message. Checked by AVG Anti-Virus. Version: 7.0.308 / Virus Database: 266.8.1 - Release Date: 23/03/2005