Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.