I have a item that gives me a result of string(26) "cake1 cake2 cake3 cake4"
The cake result comes from $_POST()
What would be the best way to make it so the final result is like:
cake1
cake2
I have a item that gives me a result of string(26) "cake1 cake2 cake3 cake4"
The cake result comes from $_POST()
What would be the best way to make it so the final result is like:
cake1
cake2
You just need to replace the spaces with <br>
's?
echo str_replace(' ', '<br />', $_POST['cake_list']);
Of course you should sanitize the POST, but this is a quick example for you.
Let's say we have a string like this
$str = "cake1 cake2 cake3 cake4";
convert your string to array like this
$arr = exploade(" ",$str);
show the elements of the array with <br>
tag like this
foreach ($arr as $value)
echo $value . "<br>";