php - Split comma-separated input box values and then store in database
329
I have a text input box where you can type tags seperated by commas. I want to store these tags separately in a table but I have no idea how to do that. I know I have to seperate the tags after they are posted so I now have this
$array = explode(',', $_POST['tag']);
Is this a good start and how do I have to go on after that?
Answer
Solution:
Creating array from your input field as in your code
$array = explode(',', $_POST['tag']);
Create a mysql multi insert query using foreach loop simillar to this:
}
now use
mysqli_query($con,$sql)
to insert values in database