-7

I'm middle of a confusion here. I'm learning PHP and studied about the advantages and disadvantages of it. Basically, I have to put PHP code inside HTML codes, thus when we load the .php file, it loads a HTML page. I'm unclear here! Why use a server-side scripting to output a HTML page, while I can simply create a .html file and open it?

DirtyBit
  • 16,613
  • 4
  • 34
  • 55
  • How do you plan to upload file or update database for example using only html? – Tomasz Sep 30 '15 at 13:48
  • How many html files will you need to display the details of 100,000 products? With a server side solution you can accomplish that with just 1. Your approach will need 100,000 different files. Then add another field to your product. – Jeff Lambert Sep 30 '15 at 13:48
  • You miss the point of dynamic web applications. It tells that you are trying to learn how to tame a horse before learning what a horse is. I suggest you rewind a bit and read stuff about Web 2.0, distributed systems, web app + databases and etc. Server scripting is **not** just a fancy HTML parser. – al'ein Sep 30 '15 at 14:05
  • yeah, thank you all. I didn't think of the moment when I have to work same kind of products or pages, again I forgot that I can't upload a file with any client-side Scripting language. I get it now. I would to maximize my views on fundamental things before going for critical sections. Thanks. – Sandipan Guha Oct 01 '15 at 08:26

1 Answers1

0

Why use a server-side scripting to output a HTML page, while I can simply create a .html file and open it? You do not need PHP for that, you can always output a HTML page with .html extension.

PHP is a server scripting language, and a powerful tool for making dynamic and interactive Web pages.PHP code can be simply mixed with HTML code, or it can be used in combination with various templating engines and web frameworks. PHP code is usually processed by a PHP interpreter, which is usually implemented as a web server's native module or a Common Gateway Interface (CGI) executable.

However you NEED PHP for one too many reason, i.e. File Uploading/Database/Dynamic Websites and the list goes on and on, which obviously can't be done using HTML only.

DirtyBit
  • 16,613
  • 4
  • 34
  • 55