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 6930241
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T11:25:18+00:00 2026-05-27T11:25:18+00:00

Need help with PHP Mysql code to insert multiple select data into database. With

  • 0

Need help with PHP Mysql code to insert multiple select data into database. With the current code i only get “Arry” in the ccaid field in the MySQL database, it should contain the Md5 code generated by first code.

Here is the code for Multiple Select data:

<?php   include ('incl/_dbconnection.php');
        include ('incl/_dbopen.php');
        include ('_header.php'); 

        $base1 = '<option value="';
        $base2 = '">';
        $base3 = '</option>';

$updatekey = md5(uniqid(mt_rand(), true));
$clientId = md5(uniqid(mt_rand(), true));

$subject = 'Complete your Registration';

mysql_query("INSERT INTO clients (clientid, cname, caddress, ctel, cfax, cmobile, cemail, cperson, cdescription, cproducts, cupdatekey, cwebsite, clastip, cvalidated)
VALUES ('$clientId', '$_POST[company]', '$_POST[address]', '$_POST[tel]', '$_POST[fax]', '$_POST[mobile]', '$_POST[email]', '$_POST[person]', '$_POST[description]', '$_POST[products]', '$updatekey', '$_POST[website]', '$_POST[ipaddress]', '$_POST[validate]')");

?>
<div class="full-width-wrapper">
                <div class="fixed-width-wrapper" id="body-content">
                    <div id="content" class="float-left content-left">
                            <h1 class="first-word sp">
                                <strong>Client Registered!</strong>
                            </h1>
                        <div id="mlogin" class="clear">
                            <h2 align="center"><strong>Choose Categories!</strong></h2>
                            <br/>
                            <table width="100%" border="0" class="m-table">
<thead>
  <tr>
    <td colspan="2" scope="col">
                        <div class="formRight">
                            <form action="registration_complete.php?id=<?php echo $clientId ;?>" method="post">
                            <select multiple="multiple" class="multiple" title="" name="categories[]">
                            <?php $SQL = "SELECT * FROM wdcategories ORDER BY `caname` ASC";
    $result = mysql_query($SQL);

    while ($db_field = mysql_fetch_assoc($result)) {

    echo $base1;
    print $db_field['caid'];
    echo $base2;
    print $db_field['caname'];
    echo $base3;

    };?>
                            </select>
                            <br/><br/><br/>
                            <button type="submit" class="black border-radius-3px bold submit" title="">
                                    Complete Registration
                                </button>
                            </tr>
  </thead>
</table></form>
                            <div class="clear">
                            </div>
                        </div>
                    </div>
<?php   
        include ('_footer.php'); 
        include ('incl/_dbclose.php');
?>

Here is the code that insert the multiple select data into the database:

<?php   include ('incl/_dbconnection.php');
        include ('incl/_dbopen.php');
        include ('_header.php'); 

        $id=$_GET['id'];

        $categories = $_POST['categories'];
for ($i = 0; $i < count($categories); $i++) {
    $category = $categories[$i];
    mysql_query("INSERT INTO ccategories (ccaid, cclientid) VALUES ('" . $_POST['categories'] . "','$id')");
} 

?>
<div class="full-width-wrapper">
                <div class="fixed-width-wrapper" id="body-content">
                    <div id="content" class="float-left content-left">
                            <h1 class="first-word sp">
                                <strong>Client Listed!</strong>
                            </h1>
                        <div id="mlogin" class="clear">
                            <h2 align="center"><strong>Registration Completed!</strong></h2>
                            <br/>
                            <img src="images/success.png" width="256" height="256">
                            <br/>
                            <h3 align="center"><a href="index.php">Click Here to add another Client</a></h3>
                            <div class="clear">
                            </div>
                        </div>
                    </div>
<?php 
        include ('_footer.php'); 
        include ('incl/_dbclose.php');
?>
  • 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-27T11:25:19+00:00Added an answer on May 27, 2026 at 11:25 am
    mysql_query("INSERT INTO ccategories (ccaid, cclientid) VALUES ('" . $_POST['categories'] . "','$id')");
    

    …should be…

    mysql_query("INSERT INTO ccategories (ccaid, cclientid) VALUES ('" . $category . "','$id')");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to insert registration data into a database but my php code isn't
I need help with some PHP code. I am retrieving data from a MySQL
i need help with disk_total_space function.. i have this on my code <?php $sql=select
I need help with this code, it doesent insert the values to my database.
i need help in debugging my code. Im new into php and im currently
I am newbee with PHP and MySQL and need help... I have two tables
I need help to use jConfirm with this existing code (php & Jquery &
i need again your help... I have this php code: <? if(isset($_POST['addnews'])){ $type =
<?php // This is a code to check the username from a mysql database
I need help with displaying images from a MySQL database. What I have is

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.