Re: Foreach

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

 



Pastor Steve wrote:
Here is my code:

 $name = $_POST['name'];
  if ($name) {
 foreach ($name as $t) {
echo "$t";
    }
$order = $_POST['order'];
    if ($order) {
    foreach ($order as $i) {
//Update the table in MySQL
        $update_data = "UPDATE sections SET `order` = '$i' WHERE name =
'$t'";
        $response = mysql_query( $update_data, $cnx );
        if(mysql_error()) die ('database error<br>'. mysql_error());
echo "$i";
    }

}

}
I am trying to get the information in name and order to update the database.
So far, I can only get one or the other. Is there a way to do this?

Thanks for your help.

--
Steve M.


Your example

http://www.cmsws.com/examples/php/testscripts/smarquez@xxxxxxxxxxxxxxx/0001.php

My solution

http://www.cmsws.com/examples/php/testscripts/smarquez@xxxxxxxxxxxxxxx/0002.php

Notice the differences

Pay close attention to the form and see how I am nesting the fields in the input name attribute.

Jim

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[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