| | |
HELP - php code to post all list box values
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Jan 2009
Posts: 2
Reputation:
Solved Threads: 0
'am a beginner & am busy designing a site that has simple order-form which captures details of a cust and submit them throuth as an email using php, which works fine.
my problem is i added 2 list boxes, one(as a drop-down) pre-populated with items-to-order which allows the user to add items in-need to the second list box...
how do i sumbit all values of the 2nd list box along as an email. My code currently is:
.
.
$listbox2 = $_POST('listbox2')
.
.
$message .= "items on order are: ";
$message .= $listbox2;
.
.
which doesn't work.
Please Help !!!!
my problem is i added 2 list boxes, one(as a drop-down) pre-populated with items-to-order which allows the user to add items in-need to the second list box...
how do i sumbit all values of the 2nd list box along as an email. My code currently is:
.
.
$listbox2 = $_POST('listbox2')
.
.
$message .= "items on order are: ";
$message .= $listbox2;
.
.
which doesn't work.
Please Help !!!!
you need to use brackets:
is the select box multiple or not. is it returning only one value.
PHP Syntax (Toggle Plain Text)
$listbox2 = $_POST['listbox2'];
is the select box multiple or not. is it returning only one value.
I assume your 2nd listbox holds multiple items and therefore your posted listbox should be an array of items,e.g. $_POST['listbox2'][0], $_POST['listbox'][1], etc. Use a for or while loop until count($_POST['listbox']) to retrieve the items. Don't know if this will work - how is your 2nd listbox populated and are you multiselecting? I thought a simple listbox (select widget) just gave you the selected value on posting.
If you are posting to the same page (not recommended), then you will overwrite your $variable. Perhaps you could use a $_SESSION variable as a quick fix to hold this data?
If you are posting to the same page (not recommended), then you will overwrite your $variable. Perhaps you could use a $_SESSION variable as a quick fix to hold this data?
Last edited by ardav; Jan 12th, 2009 at 7:24 pm.
![]() |
Similar Threads
- Dynamic drop down list not working (JavaScript / DHTML / AJAX)
- Explode and Post doesn't seem to work together (PHP)
- PHP Drop down ordering (PHP)
- Comment Box (PHP)
- pass the value to the text box (JavaScript / DHTML / AJAX)
- PHP Dynamic Form HELP! (PHP)
- Storing dynamic form values in Arrays for display & insert (PHP)
- Php newsletter error (PHP)
Other Threads in the PHP Forum
| Thread Tools | Search this Thread |
.htaccess alexa apache api array beginner beneath binary broadband broken cakephp checkbox class cms code convert cron curl database date display dynamic echo email encode error explodefunction fcc file files folder form forms function functions google howtowriteathesis href htaccess html image images include insert ip javascript joomla key keywords limit link login mail mail() memberships menu mlm multiple multipletables mysql mysql_real_escape_string network oop open passwords paypal pdf php provider query radio random redirect remote rss script search securephp server sessions smtp source space sql strip_tags syntax system table template tutorial update upload url user validator variable video voteup web youtube






