Re: Still having a form problem

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

 



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

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


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux