Start networking and exchanging professional insights

Register now or log in to join your professional community.

Follow

How can PHP and HTML interact?

user-image
Question added by Deleted user
Date Posted: 2013/04/16
Muhammad Majid Saleem
by Muhammad Majid Saleem , Senior PHP Developer / Project Manager , SwaamTech

I guess - You can pass any kind of information from PHP to HTML. But HTML can not pass any information to PHP. Remember: ----------------- PHP is a server side language and HTML is a client side language so PHP executes on server side and gets its results as STRING, ARRAYs, OBJECTS or so and then we use results to display its values in HTML.

Faizan Ahmad
by Faizan Ahmad , Software Engineer , cardekho.com

PHP processor scans the page, character by character. Until a <? PHP is found the text is sent directly to the web server in a type of copy mode. (this text may be HTML, XML, JavaScript, or anything else). Once in a <? PHP is found the input is directed to PHP, which does whatever it will with it. Any "print" output from PHP is sent to the outgoing http stream. Once a ?> is found the stream reverts to the original copy mode. PHP has the ability to send HTML, CSS, JavaScript, or anything else. You may need to force content type, but it can be done.

Deleted user
by Deleted user

Since PHP can generate HTML, and HTML can pass information to PHP, both tend to interact a lot.

Mohamed Hassan
by Mohamed Hassan , Senior Application and Integration Developer , IBM

HTML is the language that gives what you get from database by PHP the look in the browser , or in another mean HTML is the language that make the user interact with indirect with the server throw PHP, and without it user will not be able to do that

Hazem Salama
by Hazem Salama , Senior Member of Technical Staff , Verizon Communications

HTML is a MARKUP language, so it does NOT interact with anything! PHP is a server-side language that generates the HTML that is sent back to the client (the browser)! When the webserver receives a request for a page with a .php extension, it forwards the request to the PHP engine, which in turn parses the file requested (index.php for example) and processes anything in between the <?php> tags, and then puts all together as HTML and sends it back to the browser, since this is the only thing the browser will understand. This is very simplified of course, but you get the picture.

More Questions Like This