Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Website Design/Showcase (http://www.chiefdelphi.com/forums/forumdisplay.php?f=64)
-   -   PHP Question (http://www.chiefdelphi.com/forums/showthread.php?t=28690)

Raven_Writer 22-05-2004 16:05

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:

PHP Code:

$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).

Guest 22-05-2004 18:19

Re: PHP Question
 
This should work.

You can't "echo" an array. nl2br converts all new lines into HTML <BR> tags.

Correct code:
PHP Code:

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


Raven_Writer 22-05-2004 18:42

Re: PHP Question
 
Thank you. Apperantly, I had to refresh more than once. It works now....thanks again much.


All times are GMT -5. The time now is 08:49.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi