tags:

views:

60

answers:

3

I have a php script that uses a $content variable to write text to a newly created html page that is empty. my php script works great using regular ascii text. when i try to insert html markup tags i get an error and script stops working. here is an example. the html write doesn't work no matter what html tags i use. $Content = "echo ""; echo ""; echo "require_once('some.php')"; echo "Hello, today is "; echo date('l, F jS, Y'); echo ""; echo "";\r\n";

i've tried echoing and not echoing. do i need to add some type of delimeter or is there a php function i should be using that can get around this problem?

A: 

If you wish to output information to your HTML page then:

echo "<b>This is bold</b> This isn't";

Would be the correct format. I see you doing a few things that are obviously broken in the snippets you posted but I have no idea what you're really trying to do.

Why are you putting your content in a variable before outputting it? If you have all your content in $content, the the format to use would be

echo $content;

Maybe if you posted the actual script someone could be of more help.

Erik
A: 

First that "php example" shows on google: http://www.php-scripts.com/php_diary/php_scripts.html

Ondra Žižka
+1  A: 

Making your code a little more presentable...

$Content = "echo "";
echo "";
echo "require_once('some.php')";
echo "Hello, today is ";
echo date('l, F jS, Y');
echo "";
echo "";\r\n";

Reveals a parse error at the very beginning. $Content = "echo ""; contains an extra quotation mark (") which the interpreter won't be happy about. It looks like you're trying to assign all your php code to a variable, which is probably not what you are trying to accomplish.

It seems more likely that you're hoping to...

require_once('some.php');
echo "Hello, today is ";
echo date('l, F jS, Y');
echo "\r\n";
echo "<!-- Added by Richard for kicks -->";

Try it again and when you visit the script via a browser, go to View->Source and you should see that everything your PHP script echos is there.

LeguRi