943,916 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 4343
  • PHP RSS
Jan 12th, 2009
0

HELP - php code to post all list box values

Expand Post »
'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 !!!!
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Metse is offline Offline
2 posts
since Jan 2009
Jan 12th, 2009
-1

Re: HELP - php code to post all list box values

you need to use brackets:

PHP Syntax (Toggle Plain Text)
  1. $listbox2 = $_POST['listbox2'];

is the select box multiple or not. is it returning only one value.
Reputation Points: 235
Solved Threads: 193
Nearly a Posting Virtuoso
kkeith29 is offline Offline
1,315 posts
since Jun 2007
Jan 12th, 2009
0

Re: HELP - php code to post all list box values

Thanks for the correction kkeith29

just made a typing error there.. my current code is currently as:

$listbox2 = $_POST['listbox2']; & still do not run well..
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Metse is offline Offline
2 posts
since Jan 2009
Jan 12th, 2009
0

Re: HELP - php code to post all list box values

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?
Last edited by ardav; Jan 12th, 2009 at 7:24 pm.
Sponsor
Featured Poster
Reputation Points: 1048
Solved Threads: 948
Sarcastic Poster
ardav is offline Offline
6,698 posts
since Oct 2006
Jul 14th, 2010
0
Re: HELP - php code to post all list box values
I want to use list box with php through email
Reputation Points: 10
Solved Threads: 0
Newbie Poster
mak_80 is offline Offline
1 posts
since Jul 2010

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: Deleting files after xx days php
Next Thread in PHP Forum Timeline: requirement for php development





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC