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

  • SEARCH
  • Home
  • 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 6202407
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T04:43:48+00:00 2026-05-24T04:43:48+00:00

<?php if(isset($_REQUEST[‘submit’])) { $category = mysql_real_escape_string(implode(‘,’, $_POST[‘category’])); } $ins=mysql_query(insert into fruits (`category`) values (‘$category’)

  • 0
<?php 
 if(isset($_REQUEST['submit']))
 {
        $category = mysql_real_escape_string(implode(',', $_POST['category']));

 }

$ins=mysql_query("insert into fruits (`category`) values ('$category') " ) ;

?>

<form name="form1" method="post" action="">
<input type="checkbox"    name="category[]" value="apple" >Apple
<input type="checkbox"    name="category[]" value="orange" >Orange
<input type="checkbox"    name="category[]" value="mango" >Mango
<input type="submit" name="submit" value="submit"  />
</form>

I need to save checkbox value like [apple][orange][mango] but now it save like apple,orange,mango

can anyone help me ?

  • 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-24T04:43:49+00:00Added an answer on May 24, 2026 at 4:43 am

    Use cycle to create string you need

    $category = '';
    
    foreach ( $_POST['category'] as $cat )
    {
        $category .= '[' . $cat . ']';
    }
    
    $ins=mysql_query("insert into fruits (`category`) values ('$category') " ) ;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

<?php if(isset($_REQUEST['searchcat'])) { $search_category = $_REQUEST['searchcat']; switch($search_category) { case 'Purchase': $city = mysql_real_escape_string($_REQUEST['city']); $location
Take this code: <?php if (isset($_POST['action']) && !empty($_POST['action'])) { $action = $_POST['action']; } if
topic.php $id = isset($_GET['id']) ? intval($_GET['id']) : 0; $query = mysql_query(SELECT * FROM topics
My email code isn't working. <?php if(isset($_POST['send'])){ $to = info@erbimages.com ; // change all
<?php if(isset($_GET['action'])){ switch ($_GET['action']) { case 'login': include 'header.php'; if($_SERVER['REQUEST_METHOD'] == post){ if(!empty($_POST['password']) &&
My php code looks like that if (isset($_REQUEST['term'])) { $term = trim(strip_tags($_REQUEST['term']));//retrieve the search
<?php if (isset($_GET['action']) && (!$_GET['action'] == 'reply')) { ?> <div class=actions> <input type=button onclick=javascript:
I have the following pages: page1.php <?php if (isset($_GET['link'])) { session_start(); $_session['myvariable'] = 'Hello
I got some legacy code that has this: <?PHP if(isset($_GET['pagina'])==homepage) { ?> HtmlCode1 <?php
I am using this PHP code: if (isset($_GET['c'])) { $pages = array(home, upload, signup);

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.