RE: [PHP] Select multiple payment mode
I guess the thing to do would be to log in payments in the database. So lets say the total is $50.00, if the user pays $25 on cc and payment is authorized, then log this into the database, then show the remaining balance. At this point you can give user the option to pay the remaining balance using a different payment method. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 30, 2003 11:58 PM To: PHP General list Subject: [PHP] Select multiple payment mode Hi all, I am working on a receipt payment system whereby there is a "select" box with a list of payment mode: eg.By cash, By Nets, By Cheque etc...for customers to select the kinda payment mode they going to make their payment. How ever, there is cases in which instead of selecting only one payment mode. They pay through two payment modes eg.Cheque+cash. In this case, how can I go about doing it using HTML MySQL and PHP ??how should the DB be like?HTML and PHP??? Regards, Irin. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Select multiple payment mode
Hi all, I am working on a receipt payment system whereby there is a "select" box with a list of payment mode: eg.By cash, By Nets, By Cheque etc...for customers to select the kinda payment mode they going to make their payment. How ever, there is cases in which instead of selecting only one payment mode. They pay through two payment modes eg.Cheque+cash. In this case, how can I go about doing it using HTML MySQL and PHP ??how should the DB be like?HTML and PHP??? Regards, Irin. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SELECT MULTIPLE form variable?
Its the littlest things that kill ya Thanks a ton! As a side note, I definitely do NOT have the brackets on the working page - so its an undefined "feature" (or bug) that numerical-value SELECT MULTIPLE variables post as an array to PHP. Take care, and thanks again! --Noel - Original Message - From: "Leif K-Brooks" <[EMAIL PROTECTED]> To: "Noel Wade" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Saturday, June 14, 2003 1:26 PM Subject: Re: [PHP] SELECT MULTIPLE form variable? > You need to name it formfield[], not formfield. > > Noel Wade wrote: > > >Hi all, > > > >So I was under the impression that an HTML form "SELECT MULTIPLE" item would > >return an array with all of the selected items. This array can then be used > >with any of the standard PHP array functions, yes? > > > >I have 1 HTML page that seems to work fine... However, another page that is > >nearly identical is failing - giving me the following error: "Wrong > >datatype for second argument in call to in_array". When I look at the > >variable, it seems to ONLY contain a string - the first item the user > >selected. > > > >The only difference I can see is that the working SELECT MULTIPLE has > >numerical values, and the dysfunctional one uses string values - but the > >values ARE enclosed in quotation-marks... so I don't know why they're not > >POSTing properly as an array. Is this a known bug or issue? Any thoughts > >or solutions? > > > >Thanks a bunch, take care, > > > >--Noel > > > > > > > > > > > > -- > The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SELECT MULTIPLE form variable?
You need to name it formfield[], not formfield. Noel Wade wrote: Hi all, So I was under the impression that an HTML form "SELECT MULTIPLE" item would return an array with all of the selected items. This array can then be used with any of the standard PHP array functions, yes? I have 1 HTML page that seems to work fine... However, another page that is nearly identical is failing - giving me the following error: "Wrong datatype for second argument in call to in_array". When I look at the variable, it seems to ONLY contain a string - the first item the user selected. The only difference I can see is that the working SELECT MULTIPLE has numerical values, and the dysfunctional one uses string values - but the values ARE enclosed in quotation-marks... so I don't know why they're not POSTing properly as an array. Is this a known bug or issue? Any thoughts or solutions? Thanks a bunch, take care, --Noel -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] SELECT MULTIPLE form variable?
Hi all, So I was under the impression that an HTML form "SELECT MULTIPLE" item would return an array with all of the selected items. This array can then be used with any of the standard PHP array functions, yes? I have 1 HTML page that seems to work fine... However, another page that is nearly identical is failing - giving me the following error: "Wrong datatype for second argument in call to in_array". When I look at the variable, it seems to ONLY contain a string - the first item the user selected. The only difference I can see is that the working SELECT MULTIPLE has numerical values, and the dysfunctional one uses string values - but the values ARE enclosed in quotation-marks... so I don't know why they're not POSTing properly as an array. Is this a known bug or issue? Any thoughts or solutions? Thanks a bunch, take care, --Noel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Select multiple boxes
John W. Holmes wrote: How does php know what "suitable form data" is? I guess it could look for multiple names in the GET or POST data. But then that would mean for every variable it goes to create, it would have to go and look if it's already created one by that name. If it did, erase the old one and make these two an array now. I guess this is what Oracle 8i must do since if there is more than one element of the same name then an array is automatically made. Seems fine except that the special case of when you are expecting more than one but only one exists. It is no longer an array. Either extra code to handle it, or what I often do is add a hidden dummy element of the same name to force an array. Rather than doing that, it can just look for [] in the name and it knows to make that an array. All in all, I think the [] syntax ends up with less work for me to do. So IMHO I feel PHP has it right. Regards Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Select multiple boxes
John W. Holmes wrote: use [] in your select box name. When it comes back in the $_POST array you will have an array of options. It breaks HTML standard No, it does not break HTML standards -- that is a PHP urban myth (which, to my chagrin, I helped to propagate before a wiser head sent me to read said standards in minute detail). It does not even break XHTML standards. Believe me -- I've interrogated the damn standards to within an inch of their lives, and they nonetheless insist that [] are legal characters in form element name= attributes, and form element name= attributes are *not* deprecated. while I agree that it doesn't break standards - I do find it odd. and annoying in that it limits the ability of php to process certain forms ... I don't see any benefit of this system - it would be better if php just created an array for suitable form data - without requiring that the element name changes. How does php know what "suitable form data" is? I guess it could look for multiple names in the GET or POST data. But then that would mean for every variable it goes to create, it would have to go and look if it's already created one by that name. If it did, erase the old one and make these two an array now. Rather than doing that, it can just look for [] in the name and it knows to make that an array. well I think you answered your own query - it could look for multiple names ... this seems to work well in other systems - eg Perl:CGI and Java Servlets - though as these have seperate types for an array - so it works quite naturally there. in fact I have only seen this construct in php - it seems odd to me. I have worked on several projects where forms have been used to communicate between systems under the control of different development teams - in this case the requirement to rename the form element for it to work as a select multiple has been a pain. -- Sean -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Select multiple boxes
> >>use [] in your select box name. When it comes back in the > >>$_POST array you > >>will have an array of options. It breaks HTML standard > > > > > > No, it does not break HTML standards -- that is a PHP urban myth (which, > to > > my chagrin, I helped to propagate before a wiser head sent me to read > said > > standards in minute detail). It does not even break XHTML standards. > > > > Believe me -- I've interrogated the damn standards to within an inch of > > their lives, and they nonetheless insist that [] are legal characters in > > form element name= attributes, and form element name= attributes are > *not* > > deprecated. > > > > while I agree that it doesn't break standards - I do find it odd. > > and annoying in that it limits the ability of php to process certain > forms ... > > I don't see any benefit of this system - it would be better if php just > created an array for suitable form data - without requiring that the > element name changes. How does php know what "suitable form data" is? I guess it could look for multiple names in the GET or POST data. But then that would mean for every variable it goes to create, it would have to go and look if it's already created one by that name. If it did, erase the old one and make these two an array now. Rather than doing that, it can just look for [] in the name and it knows to make that an array. ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Select multiple boxes
Ford, Mike [LSS] wrote: -Original Message- From: Cal Evans [mailto:[EMAIL PROTECTED]] Sent: 18 January 2003 14:41 use [] in your select box name. When it comes back in the $_POST array you will have an array of options. It breaks HTML standard No, it does not break HTML standards -- that is a PHP urban myth (which, to my chagrin, I helped to propagate before a wiser head sent me to read said standards in minute detail). It does not even break XHTML standards. Believe me -- I've interrogated the damn standards to within an inch of their lives, and they nonetheless insist that [] are legal characters in form element name= attributes, and form element name= attributes are *not* deprecated. while I agree that it doesn't break standards - I do find it odd. and annoying in that it limits the ability of php to process certain forms ... I don't see any benefit of this system - it would be better if php just created an array for suitable form data - without requiring that the element name changes. still - I guess it works :) -- Sean -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Select multiple boxes
> -Original Message- > From: Cal Evans [mailto:[EMAIL PROTECTED]] > Sent: 18 January 2003 14:41 > > use [] in your select box name. When it comes back in the > $_POST array you > will have an array of options. It breaks HTML standard No, it does not break HTML standards -- that is a PHP urban myth (which, to my chagrin, I helped to propagate before a wiser head sent me to read said standards in minute detail). It does not even break XHTML standards. Believe me -- I've interrogated the damn standards to within an inch of their lives, and they nonetheless insist that [] are legal characters in form element name= attributes, and form element name= attributes are *not* deprecated. Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning & Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Select multiple boxes
What you are describing is a "2 List Mover". PHP is a server-side language and as such knows nothing about what is going on on the client. Therefore you have limited options. My favorite is : In your form's onSubmit() put code to load all the values into a hidden field. (Assuming you have defined the hidden field) in your JavaScript put things like document.mainForm.storeStuffHere.value += "storeStuffHere[1]='Value1'"; document.mainForm.storeStuffHere.value += "storeStuffHere[2]='Value2'"; document.mainForm.storeStuffHere.value += "storeStuffHere[3]='Value3'"; Then, when the form is submitted use: parse_str($_POST['storeStuffHere']); This will create the array storeStuffHere with the 3 values. HTH, =C= * * Cal Evans * Stay plugged into your audience. * http://www.christianperformer.com * -Original Message- From: Gregory Chagnon [mailto:[EMAIL PROTECTED]] Sent: Saturday, January 18, 2003 9:31 AM To: [EMAIL PROTECTED] Subject: Re: [PHP] Select multiple boxes The problem is I have 2 seelect boxes...it's for creating a user and adding them to a list of available groups...so I have one select box that is initially empty called memberOf and another box that has all of the available groups listed in it called availableGroups. I have a script that can move items back and forth and when the form is submitted I want to be able to get all the items that are in the memberOf box..anyh ideas on how to to this? THanks. -Greg "John W. Holmes" <[EMAIL PROTECTED]> wrote in message 000501c2bf01$46464cc0$7c02a8c0@coconut">news:000501c2bf01$46464cc0$7c02a8c0@coconut... > > Is there any way to get all of the elements in a SELECT MULTIPLE box, > not > > just the ones that are selected? Thanks! > > No. You create the box, so you should know all of the possible values. > > ---John W. Holmes... > > PHP Architect - A monthly magazine for PHP Professionals. Get your copy > today. http://www.phparch.com/ > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Select multiple boxes
> The problem is I have 2 seelect boxes...it's for creating a user and > adding > them to a list of available groups...so I have one select box that is > initially empty called memberOf and another box that has all of the > available groups listed in it called availableGroups. I have a script > that > can move items back and forth and when the form is submitted I want to be > able to get all the items that are in the memberOf box..anyh ideas on how > to > to this? THanks. Well, you create the "memberOf" box, right? How do you do that? At the same time, create a javascript or hidden variable that has its contents to be passed along with the form. ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Select multiple boxes
The problem is I have 2 seelect boxes...it's for creating a user and adding them to a list of available groups...so I have one select box that is initially empty called memberOf and another box that has all of the available groups listed in it called availableGroups. I have a script that can move items back and forth and when the form is submitted I want to be able to get all the items that are in the memberOf box..anyh ideas on how to to this? THanks. -Greg "John W. Holmes" <[EMAIL PROTECTED]> wrote in message 000501c2bf01$46464cc0$7c02a8c0@coconut">news:000501c2bf01$46464cc0$7c02a8c0@coconut... > > Is there any way to get all of the elements in a SELECT MULTIPLE box, > not > > just the ones that are selected? Thanks! > > No. You create the box, so you should know all of the possible values. > > ---John W. Holmes... > > PHP Architect - A monthly magazine for PHP Professionals. Get your copy > today. http://www.phparch.com/ > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Select multiple boxes
whoops. Sorry, didn't read the question. Wrong answer. John gave the correct answer. =C= * * Cal Evans * Stay plugged into your audience. * http://www.christianperformer.com * -Original Message- From: Cal Evans [mailto:[EMAIL PROTECTED]] Sent: Saturday, January 18, 2003 8:41 AM To: Gregory Chagnon; [EMAIL PROTECTED] Subject: RE: [PHP] Select multiple boxes use [] in your select box name. When it comes back in the $_POST array you will have an array of options. It breaks HTML standard therefore it is a Bad Thing (tm) but it does work. Don't pick me Pick me Selecting both results in: $_POST['mySelect'][1] == "Don't pick me" $_POST['mySelect'][2] == "Pick me" HTH, =C= * * Cal Evans * Stay plugged into your audience. * http://www.christianperformer.com * -Original Message- From: Gregory Chagnon [mailto:[EMAIL PROTECTED]] Sent: Friday, January 17, 2003 11:14 PM To: [EMAIL PROTECTED] Subject: [PHP] Select multiple boxes Hi- Is there any way to get all of the elements in a SELECT MULTIPLE box, not just the ones that are selected? Thanks! -Greg -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Select multiple boxes
> Is there any way to get all of the elements in a SELECT MULTIPLE box, not > just the ones that are selected? Thanks! No. You create the box, so you should know all of the possible values. ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Select multiple boxes
use [] in your select box name. When it comes back in the $_POST array you will have an array of options. It breaks HTML standard therefore it is a Bad Thing (tm) but it does work. Don't pick me Pick me Selecting both results in: $_POST['mySelect'][1] == "Don't pick me" $_POST['mySelect'][2] == "Pick me" HTH, =C= * * Cal Evans * Stay plugged into your audience. * http://www.christianperformer.com * -Original Message- From: Gregory Chagnon [mailto:[EMAIL PROTECTED]] Sent: Friday, January 17, 2003 11:14 PM To: [EMAIL PROTECTED] Subject: [PHP] Select multiple boxes Hi- Is there any way to get all of the elements in a SELECT MULTIPLE box, not just the ones that are selected? Thanks! -Greg -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Select multiple boxes
Hi- Is there any way to get all of the elements in a SELECT MULTIPLE box, not just the ones that are selected? Thanks! -Greg -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] select multiple
Use implode to make the array into a string and insert that. Depends on your database structure exactly how you'd do it... www.php.net/implode ---John Holmes... - Original Message - From: <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, July 31, 2002 8:56 AM Subject: [PHP] select multiple Hello, i have done as told to select multiple value from a html form, but i cannot insert all of them into MySql database. it inserts Array into the field, instead of the list of values. What can i do? Is there a special script to insert them? i tried, $str = ""; foreach ($tableau as $k=>$v) $str= $v . " "; $sjt1=$_POST["sjt1"]; and then the insert command (among others )but it's always the same story. Please help, thanks --- L'e-mail gratuit pas comme les autres. NOMADE.FR, pourquoi chercher ailleurs ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] select multiple
It depends on how you want them to be in the database. If you want comma-delimited, then just use implode(). $array = array("Red", "Blue", "Green"); $comma_seperated = implode(", ", $array); $space_seperated = implode(" ", $array); There really is no limit to how you want to do this. Then just use explode() with the same arguments (although replace array with the comma_seperated string) to go back to an array. HTH! Martin Clifford Homepage: http://www.completesource.net Developer's Forums: http://www.completesource.net/forums/ >>> "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> 07/31/02 08:56AM >>> Hello, i have done as told to select multiple value from a html form, but i cannot insert all of them into MySql database. it inserts Array into the field, instead of the list of values. What can i do? Is there a special script to insert them? i tried, $str = ""; foreach ($tableau as $k=>$v) $str= $v . " "; $sjt1=$_POST["sjt1"]; and then the insert command (among others )but it's always the same story. Please help, thanks --- L'e-mail gratuit pas comme les autres. NOMADE.FR, pourquoi chercher ailleurs ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] select multiple
Hello, i have done as told to select multiple value from a html form, but i cannot insert all of them into MySql database. it inserts Array into the field, instead of the list of values. What can i do? Is there a special script to insert them? i tried, $str = ""; foreach ($tableau as $k=>$v) $str= $v . " "; $sjt1=$_POST["sjt1"]; and then the insert command (among others )but it's always the same story. Please help, thanks --- L'e-mail gratuit pas comme les autres. NOMADE.FR, pourquoi chercher ailleurs ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] select multiple within for-each (SOLVED)
Please disregard the previous posting I made. I figured it out. On Mon, Jul 15, 2002 at 10:52:23AM +0200, William S. wrote: > This works OK with creating buttons but is not what I want. > POST/INPUT > > > > > > myform -- Bill Amsterdam, NL -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] select multiple within for-each
This works OK with creating buttons but is not what I want. POST/INPUT myform list.php post submit insert ***This is what I would like to do but it does _not_ work and is wrong.*** POST/SELECT MULTIPLE myform list.php post insert So how do I get a select-multiple form to work this way? -- Bill Amsterdam, NL -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php