vendredi 10 mars 2017

php Form Checkbox INSERT data into Mysql

Hello Everyone i'm new here,i want to create a form for my clients to choose the size of the product using checkboxes Small,Medium,Large and also the client info.Here is the code still can't figure out the problem,Please i need some help:i want to insert it into my table as an array (example: size-->Medium .. )

include("../admin/conn.php");
$conn = mysqli_connect("localhost", "root", "", "vm");
if(isset($_POST['passer'])){
$nom=$_POST['nom'];
$tel=$_POST['tel'];
$adresse=$_POST['adresse'];
$size = implode(",",$_POST['size']); //S M L
$sql_size="INSERT INTO `salades` (id,size) VALUES('','".$size."')";
if(mysqli_query($conn,$sql_size)){echo "Salade Size Added";}
else{echo "Error";}
$req_clt =mysqli_query($conn,"INSERT INTO `clt_vertmidi` (Id_clt,Nom_clt,      Tel_clt, Adresse_clt) VALUES ('','".$nom."', '".$tel."', '".$adresse."')");
if(!$req_clt){die("Failed");
}echo 'Client Added successfully!!!';
}




Aucun commentaire:

Enregistrer un commentaire