foreach ($_SESSION["cart_item"] as $item ){
$name=$item['name'];
$a=$item['p1'];
$b=$item['img1'];
$pname=$item['pname'];
$email=$item['email'];
$size=$_POST['sizea'];
$ddate=date('Y/m/d');
$p="insert into orders(order_id,ddate,customer,product,pname,p_img,size,email) values('$last','$ddate','$name','$a','$pname','$b','$size','$email')";
mysql_query($p) or die(mysql_error());
}
<select name="sizea[]" id="planida" >
<option>Select Plan</option>
<option value="XL">XL</option>
<option value="M" >M</option>
</select>
Output: Size: Array // not work

order_id ddate customer product pname p_img size email
1 19-02-2021 Don product1 Shirts Shirts123.jpg Array don123@gmail.com
1 19-02-2021 Don product2 Tshirts tshirts578.jpg Array don123@gmail.com

$size=implode(',',$_POST['sizea']);
Output: Size: XL,M //

order_id ddate customer product pname p_img size email
1 19-02-2021 Don product1 Shirts Shirts123.jpg XL,M don123@gmail.com
1 19-02-2021 Don product2 Tshirts tshirts578.jpg XL,M don123@gmail.com

expected answer order_id ddate customer product pname p_img size email
1 19-02-2021 Don product1 Shirts Shirts123.jpg XL don123@gmail.com
1 19-02-2021 Don product2 Tshirts tshirts578.jpg M don123@gmail.com

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.