Thursday, November 15, 2012

Answers > What Is the Difference Between PHP and XHTML Code?

What Is the Difference Between PHP and XHTML Code?

by nForms on April 12, 2012

im kinda new to this but, what benefits does PHP over xhtml and vice versa.

I am trying to create a website where people can login but I don't now what type of code is best for me.
Any Suggestions?

Tags: , , , , , ,

Similar XForms | XML Posts

{ 3 comments… read them below or add one }

steve March 16, 2011 at 9:35 am

Im going to try to explain this best I can, sorry ahead of time if im not clear enough.

xhtml is used to create invisible (or visible) boxes that you can (or cannot) physically see. You then use CSS (a style sheet) to edit those boxes to be the size, color, and position that you want. These two are used to make the part of the website that you see. (those xhtml boxes are <div>’s … xhtml can be used for more but this is just a general overview)

PHP is a server-side language that the client (whoever is visiting your site) will never see. It gets executed on the server before its sent to him.

You use php to make web pages dynamic, like your login stuff and this yahoo answers stuff we’re typing in. We type it in, it sends the information to the server where the server-side language (php) in your case plays with it and saves it in databases (php is normally used with mysql). PHP is for all the behind the scenes stuff while xhtml and css are used to make the look and feel of the page.

Hope this helps learn css learn xhtml learn php

J.J.'s Advice / Avis de J.J. March 16, 2011 at 9:35 am

It’s hard to compare XHTML to PHP. One compliments the other. XHTML is a static information-based markup language executed on the client side. PHP is a dynamic backend scripting language executed by the server.
That means that your browser never reads PHP. The PHP is pre-processed by the server and converted into XHTML. PHP stands for PHP Hypertext Preprocessing Language. The initial P in PHP standing for PHP is a little joke about the recursive nature of the language.

If you want to have a login with user accounts you’ll need PHP to process login forms and cookies, and MySQL, a type of database, to store the user information in. You’ll still need XHTML to actually design the form.

PHP doens’t actually show anything. It can output strings, but that’s the extent of it. It just outputs plain text. You can then use that plain text inside of XHTML tags to achieve the effect you desire.

dhanesh March 16, 2011 at 9:35 am

Hey dude,

PHP is a server side scripting language which is used to generate dynamic XHTML and sent to browser.

XHTML is just a mark up language which browser can understand and use to design the user interface.

Previous post:

Next post: