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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T04:20:18+00:00 2026-06-06T04:20:18+00:00

I have looked thoroughly, but I have not found the solution (or perhaps I

  • 0

I have looked thoroughly, but I have not found the solution (or perhaps I didn’t realize I had since I’m a novice)… Here is my problem:

My table has these six fields: username,want1,want2,want3,want4,want5. My form has username, and a multiple SELECT box where five wishes are selected. I want to insert that username and those selections together as a record, in their corresponding “cell” in the table. Here is my code (for the submit/$_POST action) so far:

*Note: I have named the multiple SELECT box “wants[]” so that it knows it’s an array.

<?php
//variables
$username = $_POST['username'];
$want = $_POST['wants'];
//connect
mysql_connect("localhost", "root", "password") or die(mysql_error()); 
mysql_select_db("test") or die(mysql_error()); 
//insert 
mysql_query("INSERT INTO The_Table (username,want1,want2,want3,want4,want5) VALUES ('$username','$want[0]','$want[1]','$want[2]','$want[3]','$want[4]')");
?>

When I test, no bugs/errors show, but the table isn’t being filled with a record. I am very new to coding, I apologize. Hopefully there is a simple solution. Thank you so much to any help or advice!!

  • 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-06-06T04:20:21+00:00Added an answer on June 6, 2026 at 4:20 am

    Try this code i hope its work for you…

    form.php

    <form action="insert.php" method="post" name="form">
    user_name : <input name="u_name" type="text" /><br />
    wish 1 : <input name="wish_1" type="checkbox" value="1" /><br />
    wish 2 : <input name="wish_2" type="checkbox" value="2"/><br />
    wish 3 : <input name="wish_3" type="checkbox" value="3"/><br />
    wish 4 : <input name="wish_4" type="checkbox" value="4"/><br />
    wish 5 : <input name="wish_5" type="checkbox" value="5"/><br />
    <input type="submit" />
    </form>
    

    insert.php

    <?php
    //variables
    $username = isset($_POST['u_name'])?$_POST['u_name']:'';
    $wish_1   = isset($_POST['wish_1'])?$_POST['wish_1']:'';
    $wish_2   = isset($_POST['wish_2'])?$_POST['wish_2']:'';
    $wish_3   = isset($_POST['wish_3'])?$_POST['wish_3']:'';
    $wish_4   = isset($_POST['wish_4'])?$_POST['wish_4']:'';
    $wish_5   = isset($_POST['wish_5'])?$_POST['wish_5']:'';
    //connect
    mysql_connect("localhost", "root", "password") or die(mysql_error()); 
    mysql_select_db("test") or die(mysql_error()); 
    //insert 
    mysql_query("INSERT INTO The_Table (username,want1,want2,want3,want4,want5) 
    VALUES ('".$username."','".$wish_1."','".$wish_2."'
    ,'".$wish_3."','".$wish_4."','".$wish_5."')");
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have looked everywhere but have not found a problem similar to this. I
I've thoroughly looked for a solution and have not found one. It seems really
I have looked for this in several places but not necessarily found the right
I have looked on here and found a few examples but nothing works so
I have looked on here and anddev for a suitable response, but haven't found
I have looked but have not found a specific answer for changing just one
Have looked for an answer here, but couldn't find one. When you call: myTableAdapter.Update(myDataTable);
I have looked but haven't found a reasonable answer. I have a first TableViewController
I have looked into this, but I’m still not quite clear how to do
have looked through many posts here on SO, and haven't found any that address

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.