html into php
how can I insert html tags into php codes I cannot remember the <?> can you please help me... And Can I use variables in html with that technique
|
You would use php to "print" the tags you seek to create. There are a number of methods for doing this - the most common of which is surrounding logic and variables. You can assign a variable in php, and then use the logic to control what HTML is generated......
|
Sorry, I'm not too sure about your problem. But you can do stuff like:
<html> <head> <title>Welcome to my site!</title> </head> <body> <?php echo 'Hello World!'; echo "</body>"; print "</html>"; ?> Hope this helps. Notice, echo and print (afaik) do exactly the same task. To print text or html tags, you must enclose the text imbetween " " or ' '. |
what are the chances of two people posting at exactly the same time?
|
As for printing plain HTML in PHP, I want to note that one can simply exit PHP mode with "?>" and reenter PHP mode with "<?php" and it is equivalent to echoing everything within those tags. Even when you use this technique inside of a conditional (if, etc.) block or loop, the echoing only happens when the block is actually executed, just like you would expect from regular "echo" statements.
Quote:
Code:
<?php echo $foo; ?> Code:
<?= $foo ?> |
thank you all for your replies...But I think there aws an another way to insert html into php than echo all the lines... The thing that I am tring to do is to create a new html or php file with fopen command....
|
Quote:
|
Code:
<? Code:
<html> there is the include command though... Code:
<? hope thats helpful. Cheers, Ben. |
All times are GMT -5. The time now is 08:41 PM. |