Search
 
SCRIPT & CODE EXAMPLE
 

PHP

how to insert multiple selected

<?php
// Make a MySQL Connection
mysql_connect("HOST_NAME", "USERNAME", "PASSWORD") or die(mysql_error());
mysql_select_db("DB_NAME") or die(mysql_error());
$checkBox = implode(',', $_POST['Colors']);
if(isset($_POST['submit']))
{       
    $query="INSERT INTO clr_tbl (colors) VALUES ('" . $checkBox . "')";     

    mysql_query($query) or die (mysql_error() );

    echo "Complete";

}

?>

<html>
<body>
<form method="post" action="">
  <input type="checkbox" name="Colors[]" value="Red">Red<br>
  <input type="checkbox" name="Colors[]" value="Blue">Blue<br>
  <input type="checkbox" name="Colors[]" value="Pink">Pink<br>
  <input type="submit" name="submit" value="submit">
</form>
</body>
</html>
Comment

sql insert multiple rows from select

INSERT INTO my_table SELECT * FROM source_table;
INSERT INTO my_table (a, b, c) SELECT a, b, c FROM source_table;
INSERT INTO my_table (a, b, c) SELECT a, b, c FROM source_table s
	WHERE s.my_col >= 10;
Comment

sql insert multiple rows from select

  INSERT INTO table2
     (name, email, phone)
     SELECT name, email, phone
     FROM table1;
Comment

PREVIOUS NEXT
Code Example
Php :: big int php 
Php :: laravel search query 
Php :: get post index wordpress 
Php :: php curl request 
Php :: laravel collection push 
Php :: PHP utf8_encode — Converts a string from ISO-8859-1 to UTF-8 
Php :: laravel use function from another controller 
Php :: Convert String containing commas to array 
Php :: laravel 6 auth 
Php :: php date set utc hours 
Php :: if condition view page of laravel 
Php :: if browser url is having domain name in it check using php 
Php :: install php 5.6 mac 
Php :: php interface vs abstract class 
Php :: Wordpress disable admin bar to users except admin 
Php :: calculate total time from start and end datetime in php 
Php :: symfony change php version 
Php :: codeigniter order_by 
Php :: php array flip 
Php :: laravel create resource controller 
Php :: how to pass parameter in routes of laravel 
Php :: laravel routes return view in web.php 
Php :: wordpress post types supports thumbnail 
Php :: apache2 php 8 update not working 
Php :: laravel hasMany with join 
Php :: appserviceprovider laravel auth user 
Php :: php submit form in new tab 
Php :: add custom attribute for validation errors laravel 
Php :: upgrade php7 to php 8 xampp 
Php :: concat php 
ADD CONTENT
Topic
Content
Source link
Name
2+5 =