Jump to content

Newb Problem


MarioApprentice

Recommended Posts

Hey everyone, i have a basic question.

 

I've downloaded xampp and have been going trough Programming PHP book and found that embedding php in html is a problem.

I've googled this and im doing everything right. ive alo copy/pasted some code that should work but it doesn't.

 

<head>
</head>
<body>
<p>This is written but this [code=php:0]this is not[/code]
</p>
</body>
</html>

 

The question is newbie. The php output is not showing on my browser. The file is php extension not html, its in the right tags and it wont show.

Also, when i embedd a HTML element inside echo, that shows but with an this: "?>. Like this

 

<p>

<?php echo "<p>Hey</p>"?>

</p>

 

This would output Hey but with addiotional "?> in a newline.

 

Thank you for all your answers.

Link to comment
https://forums.phpfreaks.com/topic/271289-newb-problem/
Share on other sites

Hey everyone, i have a basic question.

 

I've downloaded xampp and have been going trough Programming PHP book and found that embedding php in html is a problem.

I've googled this and im doing everything right. ive alo copy/pasted some code that should work but it doesn't.

 

<head>
</head>
<body>
<p>This is written but this [code=php:0]this is not[/code]
</p>
</body>
</html>

 

The question is newbie. The php output is not showing on my browser. The file is php extension not html, its in the right tags and it wont show.

Also, when i embedd a HTML element inside echo, that shows but with an this: "?>. Like this

 

<p>

<?php echo "<p>Hey</p>"?>

</p>

 

This would output Hey but with addiotional "?> in a newline.

 

Thank you for all your answers.

 

Can you post your full code? You've probably not closed some quotation marks somewhere.

Link to comment
https://forums.phpfreaks.com/topic/271289-newb-problem/#findComment-1395852
Share on other sites

ok. here it is for copy/paste

 

<!doctype html>

<html>

<head>

<title>This is my first PHP program!</title>

</head>

<body>

<p>This is going to be ignored by PHP and displayed by the browser.</p>

 

<?php echo 'While this is going to be parsed.'; ?>

 

<p>This will also be ignored by PHP and displayed by the browser.</p>

</body>

</html>

 

Here it is. This is an example from google by some website. They are all the same but none of them works on me.

Link to comment
https://forums.phpfreaks.com/topic/271289-newb-problem/#findComment-1395853
Share on other sites

ok. here it is for copy/paste

 

<!doctype html>

<html>

<head>

<title>This is my first PHP program!</title>

</head>

<body>

<p>This is going to be ignored by PHP and displayed by the browser.</p>

 

<?php echo 'While this is going to be parsed.'; ?>

 

<p>This will also be ignored by PHP and displayed by the browser.</p>

</body>

</html>

 

Here it is. This is an example from google by some website. They are all the same but none of them works on me.

 

There's no reason for that not to work.

 

You ARE opening your .php files on your local server, right?

Link to comment
https://forums.phpfreaks.com/topic/271289-newb-problem/#findComment-1395854
Share on other sites

Yes, I am. Also

 

Also, when I put <p> inside echo it works but alone it doesnt.

 

<!doctype html>

<html>

<head>

<body>

<?php echo "doesn't work"?>

<p>

<?php echo"<p>Works</p>";?>

</p>

</body>

</head>

</html>

 

At the end, the only thing that outputs is ";?> and thats it.

Link to comment
https://forums.phpfreaks.com/topic/271289-newb-problem/#findComment-1395859
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.