Re: Array problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx 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




[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux