By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,203 Members | 1,636 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,203 IT Pros & Developers. It's quick & easy.

pulling mulitple selection listboxes into a PHP array for updating a MySQL DB with

P: 2
I may be being really stupid here, i have spent the last 3 hours looking round your site and some other for answers to my problem, but have not had much luck (possibly cuase my brain just isn't working today)

I have EasyPHP2.0b1 Apache/MySQL server installed on my Windows XP(SP2) machine. This runs Apache 2.2.3, MySQL 5.0.27 and PHP 5.2.0

I have a PHP code filled listbox, which allows multiple selections.
Actual Values are "rcd_no, cn_no"
Also I have a simple textbox which holds "invoice_no"

I am tying to do several things at once (well i know technically one after another)
1. i need to pull out all the selected values, i am still not sure how the values are stored by the listbox for multiple selctions, and am unsure of how to get the mulitple value selections from the listbox into a PHP array

2. i need to split them to get he rcd_no and cn_no seperate (as they form a Primary key on the table i am trying to update), this i believe should be easier to do in JavaScript nd then in thory done before 1, but was wondering if it was doable in PHP

3. i need to update multiple rows in the database based on the selected rcd_no and cn_no's. with invoice_no. Assuming i should be able to use
[PHP]foreach();[/PHP]
or at worst a standard for loop, pulling the different values for the WHERE clause out and updating the same value (invoice_no) into multiple lines in the DB table.

I have seen several code postings for different bits of these, but can't seem to make my head convert/merge them to what i'm after

I hope this makes sense, there is no code posted cause i'm just completely at a loss atm.

Cheers
Julie
Nov 17 '07 #1
Share this Question
Share on Google+
2 Replies


ak1dnar
Expert 100+
P: 1,584
First I'll give you a simple example. This how you can get a listmenu values to a array in php. And I'm sorry your question is not that much clear to me. do you have an example of what you want to happend? I mean any code.

Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <body>
  3. <form action="server_page.php" method="post">
  4. <select name="my_list_menu[]" size="3" multiple>
  5. <option value="value1">Disply_value_1</option>
  6. <option value="value2">Disply_value_2</option>
  7. <option value="value3">Disply_value_3</option>
  8. </select>
  9. <input name="" type="submit" />
  10. </form>
  11. </body>
  12. </html>
  13.  
server_page.php
Expand|Select|Wrap|Line Numbers
  1. <?php
  2. print_r($_POST['my_list_menu']);
  3. ?>
EDIT: Hey welcome to TheScripts.com
Nov 17 '07 #2

P: 2
Cheers for the reply,

I have actually managed to fix it now, my coding brain stoped hiding, and i got it to work.

At the time of post i didn't have any code except the standard filling of the listbox with PHP.

Cheers again

Jules
Nov 18 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.