Search
 
SCRIPT & CODE EXAMPLE
 

PHP

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> 
";
echo $songList;

function test_input($data)
{
   $data = trim($data);
   $data = stripslashes($data);
   $data = htmlspecialchars($data);
   return $data;
}

?>
Comment

PREVIOUS NEXT
Code Example
Php :: php check if day in month 
Php :: Laravel 8 - get values of url query strings in controller 
Php :: PHP - AJAX and PHP 
Php :: PDO Prepared Statement php 
Php :: laravel model isdirty 
Php :: Laravel return empty relationship on model when condition is true 
Php :: delay queue laravel 
Php :: get woocommerce my account page url 
Php :: PHP temporary files 
Php :: laravel load relationship 
Php :: php photo upload 
Php :: laravel eloquent multiple join 
Php :: drupal 8 entity_view 
Php :: mktime() php 
Php :: find diiference in minutes un laravel 
Php :: laravel migration char length 
Php :: Regex to remove span tags using php [duplicate] codegrepper 
Php :: php random number 
Php :: like button phpAdd Answer 
Php :: php capture include 
Php :: empty func php 
Php :: accept method in jquery 
Php :: where statement multiple argument in codeigniter 
Php :: guzzlehttp submit form file 
Php :: action php self 
Php :: php draw line pixel 
Php :: using laravel passport with mongodb 
Php :: text to sha256 converter in laravel 
Php :: laravel form request validation api 
Php :: dropdown search php mysql 
ADD CONTENT
Topic
Content
Source link
Name
4+1 =