I almost finished the PHP course but I still have no idea on how to use it on my website project, can you enlighten me? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

I almost finished the PHP course but I still have no idea on how to use it on my website project, can you enlighten me?

I have a website project, i know html and css but i want it to be dynamic because I want user functionality. Now, how do I use css on PHP, how PHP can be used in my html files? I think I'm lost, I think there's something missing in comprehending PHP on how to use it on development. Is there any resources that can help me from confusion?

11th Sep 2018, 11:06 AM
Khyn Harold Jay Antoque
Khyn Harold Jay Antoque - avatar
4 Answers
+ 2
I think the confusion comes from understanding the difference between front end (client side) and back end (server side). Between the server and client is the wire (router, modem, ISP magic, etc.), so the client shoves messages through the wire to the (your) server and your server figures out what to do with those messages (like maybe send some packets of information to the client). The link I posted earlier covers these a little bit. PHP is a back end language, so you can use it to create the server side end points (i.e. if I receive a message with this or that message header, this is how I should respond). By default, PHP is not used "in HTML" per se (like in the following link, if you just read the code, it will look like you can, but when you read the introductory paragraph, it explains that you only see it that way because of their tool: https://www.w3schools.com/php/default.asp ) but PHP can generate HTML code ( https://www.w3schools.com/php/php_intro.asp ). You can also [tbc...]
11th Sep 2018, 1:31 PM
Janningā­
Janningā­ - avatar
+ 1
Can you give an example of the website where the CSS will be used after using PHP?
11th Sep 2018, 11:19 AM
Email Not Activated
+ 1
Not sure if this helps: https://www.sololearn.com/learn/7896/?ref=app I wrote a longer response earlier, but the SoloLearn server pretended to accept it again, so I navigated away from the page and it was lost. I'll try again later.
11th Sep 2018, 12:22 PM
Janningā­
Janningā­ - avatar
+ 1
[... cfb] specifically configure your server to do read the PHP it finds in your HTML files (you can use a search engine to research .htaccess). HTML and CSS are front end languages. If you want your page to be interactive (which is different from dynamic in the context of web development, but you can research about statically vs dynamically served websites with a search engine too), you will want to learn JavaScript. Here's an example of what would be a common use case for PHP: https://www.w3schools.com/html/html_forms.asp Alternative presentation: https://www.w3schools.com/php/php_forms.asp I haven't been able to find any tutorials on PHP that don't start with, "You can use PHP directly in your HTML!" but I think it would be useful if PHP tutorial makers didn't oversell like this. They should really start with the setup requirements and have a giant "IF" when they introduce embedded syntaxes later on. (Someone can jump in and correct me if I'm being misleading in any way.) Hope this helps!
11th Sep 2018, 1:32 PM
Janningā­
Janningā­ - avatar