PDA

View Full Version : General question about PHP & HTML from someone who knows nothing about it.


Alex Ethridge
08-08-2005, 05:14 AM
I've been reading a little about PHP just to get an idea of how and when it is used and how it fits into a web site or page. From what I can understand, PHP is a programming language usually embedded into an HTML document. In other words, one would see PHP and HTML lines in the same page when viewing the source.

Is this correct?

If it is correct, then it really would not be sensible to try to learn PHP without first learning HTML.

Is this right or wrong?

Your help in my understanding this is appreciated.

kitchin
08-08-2005, 11:32 AM
Yes, learn some HTML first. But HTML can be very simple. You can just make a file called "index.html" and put in it the text "My web page!" and that will work... as long as no one calls the standards police! :siren: HTML is very tolerant.

The PHP lines can be used to print HTML text based on logic you code into PHP.

Alex Ethridge
08-08-2005, 11:48 AM
Well, the only thing I know about HTML is what little I've played around with Dreamweaver, which is very little. Looks like I have a whole lot of HTML learning to do before I can begin with PHP.

I've been evaluating books on PHP through Amazon's reader comments which are pretty helpful. The one thing the author nor the reader comments don't emphasize enough--and in most cases don't even mention--is that a working knowledge of HTML is a prerequisite.

In other words, there is no such thing as The Absolute Beginners Guide to PHP.

Thanks for your help.

Winters
08-09-2005, 02:12 PM
You don't need to know the entire html specification in order to make PHP useful. You could reasonably get away with learning only the major tags and maybe some stuff about forms. I believe you could skip everything except forms if you really don't want to mess around with it. Your PHP would work fine, but the output would be kinda ugly :P

I consider html (and CSS) to be a sort of input and output beautification mechanism.

I would do it something like this:

1. Learn basic html page format <html><body> etc
2. Learn basic html tags like h, p, br, hr
3. Learn how POST and GET variables work
4. Learn about html forms
5. Learn how to use a form to set POST and GET variables
6. Now you're more or less ready to dive into PHP

I think once you have that down you'll have pretty much everything you need to start learning PHP and be able to make it useful and effective.. more or less. If you wanna get really hardcore you could also learn CSS to help give you more control over how your pages look, and learn about web standards so you can be an elitist and look down on non-compliant sites. :P

One suggestion I often make to anyone who is new to this is that you will learn better and more completely if you avoid using html editors - they have a bad habit of masking the mechanics of what's going on, and will probably just make things more confusing. When you first start, use notepad (or your favorite text editor).

Be patient, and take time to experiment with every step and every new thing you learn.

Good luck :)