This is my code. I used to insert Into another table
$result = "INSERT INTO voucher_m(mainhead,subhead,dr,cr) VALUES('$mainhead','$subhead','$dr','$cr'); INSERT INTO voucher_m(voucherno,type) VALUES('$Voucherno','$type') SELECT * FROM next;";
mysqli_multi_query($cser, $result);