Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6045393
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T07:07:11+00:00 2026-05-23T07:07:11+00:00

In my form: I have 8 checkboxes that will save to MySQL as a

  • 0

In my form: I have 8 checkboxes that will save to MySQL as a string/varchar (not an int).

Ex:

  • Checkbox 1 = Apple
  • Checkbox 2 = Orange
  • Checkbox 3 = Mango
  • Checkbox 4 = Grape
  • Checkbox 5 = Watermelon
  • Checkbox 6 = Melon
  • Checkbox 7 = Pineapple
  • Checkbox 8 = Cherry

Now, I want to output this to 3 different fields with limited number of characters per field.

  • Field 1 = Has a limit of 25 Characters
  • Field 2 = Has a limit of 30 Characters
  • Field 3 = Has an unlimited Characters

If all checkboxes are check and save into MySQL, the output will be:

  • FIELD 1: Apple, Orange, Mango (this field can only hold 25 characters, so I have to put the next variable data into FIELD 2).
  • FIELD 2: Grape, Watermelon (this field can only hold 25 characters, so I have to put the next variable data into FIELD 3).
  • FIELD 3: Melon, Pineapple, and Cherry

I did some research on STRLEN, EXPLODE, etc. and somehow I can’t put this together in PHP.
How could I do it?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T07:07:12+00:00Added an answer on May 23, 2026 at 7:07 am

    Perhaps wordwrap will do the trick? One way of doing it is (not tested):

    $string_list = explode("\n", wordwrap($string, 25));
    $field1 = array_shift($string_list);
    $string = implode(" ",$string_list);
    
    $string_list = explode("\n", wordwrap($string, 30));
    $field2 = array_shift($string_list);
    
    $field3 = implode("\n", $string_list);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to form a query string from multiple checkboxes that will be used
I have a form that contains a bunch of checkboxes. Before submitting the form,
I have a checkbox that when it is clicked it submits the form to
I have a checkbox list control on my asp.net web form that I am
i have a form with some checkboxes on it i want to save those
I have a HTML form containing checkboxes in the form of .. <input type=checkbox
I have a web form with about 15 checkboxes that users may check 0
I have a form that has multiple categories. They are separated by checkboxes, so
I have a form field (a series of checkboxes) that's being created dynamically from
I have a form with a checkbox that's used to filter some search results.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.