foreach loop is not run in php code example
Example: foreach loop not working in php
<?php
$songs = $_POST["songs"];
//$songs = Array("one","two","three");
foreach ($songs as $song)
{
$songStr = test_input($song);
$songsOut .= "<li>$songStr</li>";
};
$songList = "Songs: <ol> $songsOut </ol> \r\n";
echo $songList;
function test_input($data)
{
$data = trim($data);
$data = stripslashes($data);
$data = htmlspecialchars($data);
return $data;
}
?>