Just felt like sharing this.

SpaceshipSpaceship
Namecheap AuctionsNamecheap Auctions
SpaceshipSpaceship
Watch

Coolprogram

Established Member
Impact
7
PhP is also used in html. You put the HTML codes in but keep it as .php. To make a PHP form or anything else u use html in it. almost no matter what.
-Coolprogram 8-X :gn: :lol: :bah: %%-
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
Unstoppable Domains — AI StorefrontUnstoppable Domains — AI Storefront
Just to clarify what he said:

You need:

Code:
<?php

echo "
<html> 
<!-- any html wanted in here, be careful when using double quotation marks -->
</html>
";

?>
Basically you have to echo the HTML and the browser wont notice the difference. I hope this makes it a little clearer for beginners...:P
 
0
•••
You don't have to echo the HTML. Just as long as the HTML isn't within the PHP code
 
0
•••
Lol he made no sense at all, Thanks for explaining this Shorty, it might be useful to n00bs who are starting PHP /HTML coding.

I knew this back from a while ago anyway (the hard way)

Also, isnt it possible if you use double quotes on the echo that you can use a single quote in the html tags? i.e

echo" <html> <body bgcolor='#000000'>";

something like that.

Also if you want or need to put in a double quote, but dont want to put it outside a php tag, then you can always put a back slash "\" infront of it i.e

echo" <html> <body bgcolor=\"#000000\">";

I dont know, but yeah, anyway :P

PJ
 
0
•••
You can also write some C code that generates the HTML you want, place that code in a variable in your PHP script, write a C interpretor in PHP that precesses that C code and emails the output to another server where it is served to the user. Just because something can be done doesn't mean it should :)

On two occasions I've actually fired programmers for doing what's described above; inserting HTML into CGI scripts when they had been told to insert PHP into HTML.
 
0
•••
miseria said:
You don't have to echo the HTML. Just as long as the HTML isn't within the PHP code
Sometimes it's necessary.

And yeah .PJ, you can use \" or ', just never " on it's own. It's not even needed to use quotes at all in most situations, only when there are gaps in the " and " content and I think when validating. I found this all out the hard way too. ;)

When I first started coding/programming with php I went nuts for ages over a simple script that was returning a php error because I was echoing the code and using quotation marks. I guess in the end,you learn by making mistakes. (I'm amazed this simple topic has drawn so much commenting here :lol:)
 
0
•••
CatchedCatched

We're social

Escrow.com
Spaceship
Domain Recover
CryptoExchange.com
Catchy
DomDB
NameFit
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back