Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Old 04-24-2004, 05:59 AM Check box Saving
Novice Talker

Posts: 5
Trades: 0
Hello I am new in PHP..

Please help.

I want to save information on the database using checkboxes

ex.
checkbox1 value=apple
checkbox2 value=banana
checkbox3 value=grapes

i want to save it with comma separated.. depends on checkbox value is true

example output:
text = apple, banana, grapes
or
text = banana, grapes
or
text = apple, grapes

can u code for me something like that output...
Do i have to use array on this..

Thank in advance..
aspi
webstrega is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 04-24-2004, 12:05 PM
Christopher's Avatar
Iced Cap

Latest Blog Post:
Cross-domain AJAX with JSONP
Posts: 3,110
Location: Toronto, Ontario
Trades: 0
It'd be easiest to name your checkboxes on your form with a [] on the end, like this:
Code:
<input type="checkbox" name="check[]" value="apple" />
<input type="checkbox" name="check[]" value="banana" />
<input type="checkbox" name="check[]" value="grapes" />
Then you can simply use the implode() PHP function:
PHP Code:
$comma_separated implode(','$_POST['check']); 
__________________

Please login or register to view this content. Registration is FREE
- Latest Articles:
Please login or register to view this content. Registration is FREE
,
Please login or register to view this content. Registration is FREE

--
Please login or register to view this content. Registration is FREE

Christopher is offline
Reply With Quote
View Public Profile
 
Old 04-26-2004, 01:04 AM
Novice Talker

Posts: 5
Trades: 0
I am new in PHP stuff, my knowledge here is not that much...
Seeking for books or website that has good or better/basic tutorials aside from the php.net maybe you can refer something.

THank u very much Chroder, it help me much...

aspi
webstrega is offline
Reply With Quote
View Public Profile
 
Old 04-26-2004, 03:36 PM
Christopher's Avatar
Iced Cap

Latest Blog Post:
Cross-domain AJAX with JSONP
Posts: 3,110
Location: Toronto, Ontario
Trades: 0
If you want a book, I'd seriously consider purchasing PHP and MySQL Web Development. The best book I've ever read on PHP, its the one that pretty much gave me a boost into the web programming world. I have the first edition, not even sure of the additions/fixes/updates in the second
__________________

Please login or register to view this content. Registration is FREE
- Latest Articles:
Please login or register to view this content. Registration is FREE
,
Please login or register to view this content. Registration is FREE

--
Please login or register to view this content. Registration is FREE

Christopher is offline
Reply With Quote
View Public Profile
 
Old 04-27-2004, 12:55 AM
Novice Talker

Posts: 5
Trades: 0
Thanks a lot.....
webstrega is offline
Reply With Quote
View Public Profile
 
Old 06-14-2007, 01:39 PM Re: Check box Saving
Skilled Talker

Latest Blog Post:
My book update
Posts: 97
Name: Eric
Location: Las Vegas
Trades: 0
I also have that book and it is a very good place to start
__________________

Please login or register to view this content. Registration is FREE

Eric - M
Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
peanutpad is offline
Reply With Quote
View Public Profile Visit peanutpad's homepage!
 
Reply     « Reply to Check box Saving
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.16625 seconds with 12 queries