For Programmers: Free Programming Magazines  


Home > Archive > PHP DB > May 2005 > Re: [PHP-DB] Still having a form problem









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: [PHP-DB] Still having a form problem
Ross Honniball

2005-05-31, 8:56 pm

I don't understand your problem exactly, but the ghist of it makes me think
you might want to do something like this.

Sounds like you are just trying to tie id's from a database to specific
fields on your screen?

If so, you can force the index name to be pretty much anything (for
example, the id field from your database).

Rather than using <input name="quantity[]" ..., get your php code when it
is generating the html to put your id value in as an index.

ie. echo '<input name="quantity['.$id_from_database.']" ...

On submission of your form, you should be able to just go..

foreach ($_REQUEST['quantity'] as $id_from_db => $input_fld_value) ...


hope this helps ... Ross

At 05:07 AM 31/05/2005, you wrote:
>Hi there everyone,
>
>
>
>I'm still having problems with my form PHP data, I lost email for a couple
>of days due to a server crash on my account so don't know if this was
>answered or not (Sorry).
>
>
>
>Basically, I have a form which populates 25 entries at a time from a MySQL
>DB with PHP, you can select the product you want to order by entering a
>value in the quantity box, if it was a single box it wouldn't be a problem,
>but it's an array.
>
>
>
>Now again, an array for the quantity is no problem at all, as I just use
>
>
>
><input name="quantity[]" type="text" class="style8" id="quantity[]" value=""
>size="5">
>
>
>
>HOWEVER, I also need to transfer the $id (Named $id_new) from the database
>in each quantity array at the same time so I can split each array into ID
>and QUANTITY, this way I know which ID has which quantity, but this is what
>has me stumped.
>
>
>
>I tried with a HIDDEN field but of course that won't work, as there's no way
>of aligning which ID goes with which quantity, so what I guess I need to
>know, is how to amend $id_new with the quantity[] array.
>
>
>
>Any help would be REALLY appreciated as this is really urgent.
>
>
>
>Chris



.. Ross Honniball JCU Bookshop Cairns Supervisor
.. James Cook Uni, McGregor Rd, Smithfield, Qld. 4878, Australia
.. Ph:07.4042.1157 Fx:07.4042.1158 Em:ross@bookshop.jcu.edu.au
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com