Board index   FAQ   Search  
Register  Login
Board index php forum :: Database mySQL & php coding

Multiple POST Values

Codes here !

Moderators: macek, egami, gesf

Multiple POST Values

Postby rentonsa » Wed Aug 29, 2012 3:50 am

Hi folks

I am picking up info from a MySQL table like this:

Code: Select all
$sql_image="SELECT i.*, s.* FROM orders.IMAGE i,orders.STATUS s where i.order_id = $order_id  and i.status = s.id;";
         $result_image=mysql_query($sql_image) or die( "A MySQL error has occurred.<br />Your Query: " . $sql_image . "<br /> Error: (" . mysql_errno() . ") " . mysql_error());
            $num=mysql_numrows($result_image);
           

            $id = 0;
            $i = 0;
         while ($i < $num)
         {
                    $collection[$i]=mysql_result($result_image, $i, "i.collection");
                    if ($collection[$i] == null)
                    {
                        $collection[$i] = 0;
                    }
               $shelfmark[$i]=mysql_result($result_image, $i,"i.shelfmark");
               $title[$i]=mysql_result($result_image, $i,"i.title");
                    $author[$i]=mysql_result($result_image, $i,"i.author");
                    $page_no[$i]=mysql_result($result_image, $i,"i.page_no");
                    $description[$i]=mysql_result($result_image, $i,"i.description");
                   
                    $image_id[$i]=mysql_result($result_image, $i,"i.image_id");
                    if ($image_id[$i] == null)
                    {
                        $image_id[$i]= 0;
                    }
                    $status_image[$i]=mysql_result($result_image, $i,"s.name");
                    $publication_status[$i]=mysql_result($result_image, $i,"i.publication_status");                   
         
           $image_no = $i + 1;
           print ('<tr><td><h3>Image&nbsp;'.$image_no.'</h3></td></tr>
           
           <tr>
              <td>Image Id:</td>

              <td><input type="text" name="image_id" size="20" value ='. $image_id[$i].'></td>
            </tr>

            <tr>
              <td>Shelfmark:</td>

              <td><input type="text" name="shelfmark" size="20" value ="'. $shelfmark[$i].'"></td>
            </tr> etc.....


All displays ok, and multiple rows come out as desired. I'm putting the values into input fields in case they need to change.

My question is, how do I get the resultant (eg) $_POST["image_id"] fields to be indexed, and thus allow me to insert the correct values into the database on an update? I have tried declaring as an array, and appending the index value to the name, but I have had no success so far; either I get the last value of $image_id, or nothing at all.

Cheers
Scott
rentonsa
New php-forum User
New php-forum User
 
Posts: 4
Joined: Wed Aug 22, 2012 7:09 am

Re: Multiple POST Values

Postby rentonsa » Wed Aug 29, 2012 3:57 am

Hi folks,

Please ignore this post- I've got it working.

Cheers
Scott
rentonsa
New php-forum User
New php-forum User
 
Posts: 4
Joined: Wed Aug 22, 2012 7:09 am


Return to mySQL & php coding

Who is online

Users browsing this forum: No registered users and 7 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.