I am trying to insert multiple name in guestname input field. So i've declared guestname as an array. After inserting some name in guestname field using separated by comma ( e.g : superman, batman, spiderman ) i get output as "guestname":["superman, batman, spiderman "]. I want to run loop counting all the values of the array and print one by one where others data (e.g email and address) will remain same.
<input type="text" name="guestname[]" multiple>
<input type="text" name="email">
<input type="text" name="address">
<tr>
foreach(array_count_values($_POST['guestname'] as $key => $value)
{
echo "<td>". $value."</td>";
echo "<td>". $_POST["email"]."</td>";
echo "<td>". $_POST["address"]."</td>";
}
</tr>