How can PHP be used to insert multiple values from a text field into a database?

When inserting multiple values from a text field into a database using PHP, you can first retrieve the input values as an array using the `explode()` function. Then, you can loop through the array and insert each value into the database using prepared statements to prevent SQL injection.

// Retrieve the input values as an array
$inputValues = explode(',', $_POST['text_field']);

// Prepare the SQL statement
$stmt = $pdo->prepare("INSERT INTO table_name (column_name) VALUES (:value)");

// Loop through the array and insert each value into the database
foreach($inputValues as $value) {
    $stmt->execute(['value' => $value]);
}