PHP Question

While trying to get back in the swing of things (again) w/ PHP, I decided to make a lil’ poetry script. Basically, you type in some info, and then it sends you to a page asking if the information is correct, then it saves it as a file.

My problem is in the checking to see if the poem is correct. I can’t show the poem. Currently, what I’m doing is:


$poem = $_POST'poem'];
 
<?if($poem == ""){
 echo("no poem");
}else{
 $show = explode("  ", $poem);
 echo("$show");
}?>

The thing that is displayed (when there’s a poem), is “Array” (w/o quotes). I have looked at the PHP document on this, and couldn’t find really anything. Does anyone know how to fix this? (If I don’t use explode, and just show the poem, it displays the newline characters as double-spaces).

This should work.

You can’t “echo” an array. nl2br converts all new lines into HTML <BR> tags.

Correct code:


$poem = $_POST'poem'];
 
<?if($poem == ""){
echo("no poem");
}else{
$show = nl2br($poem);
echo("$show");
}?>

Thank you. Apperantly, I had to refresh more than once. It works now…thanks again much.