I'm writing a string from my form and I'd like to remove the last comma from the end. I understand that I can use the rtrim(), but I don't understand how I can return a variable from my loop. I'm sure this is an easy answer, just super confused. Thanks!
if (isset($_POST['submit'])) {
foreach ( $_POST['data'] as $data )
{
echo $data['Monday'];
echo $data['Tuesday'];
echo $data['Wednesday'];
echo $data['Thursday'];
echo $data['Friday'];
echo $data['Saturday'];
echo $data['Sunday'];
echo ", ";
}
} // end if