How stuffs Work in PHP mySQL and the real HTML Document

How stuffs Work in PHP mySQL and the real HTML Document
0.0 0

#1

I mean, If i learned PHP and mySQL… can i show the write something in an input then save it in the SQL and then write it in the document permanently??

I mean, how do things work? Can you please elaborate??


#2

php is a scripting language as javascript. so if you can render html using javascript so you can do it using php. the most important diff(regarding this matter) is that php works only back side and javascript can do it both sides(ofc for back using node).

If you wanna use php, i would take a look at 3 frameworks: laravel, symfony and codeigniter. I have enumerated these ones that have an easy learning curve. To better understand php as a beginner just go learning the basics in variables, functions, etc.


#3

Yeah, but if PHP prints it in the page, after i reload it, will the contents get lost?


#4

Your question is a bit vague. So the answer will probably be vague as well.

But the ability to send some values to a server that will parse it, then store it somewhere in an organised way, and then send it back to the user when requested, can be achieved by many different technologies.

So the answer to:

can I do it with PHP and SQL

is yes.

But so is with many other technologies.


Side note: sometimes it’s even enough to use the localStorage of your browser, especially for study projects | hobbies and so on.

I have no information on what you want to achieve but but the brief description you gave a simple:

1) check if some value is in the localStorage
 1a) yes -> populate the  document with this value
 2a) no -> it's empty, start blank

2) the user click save -> update or write the value in the storage

A lot depends on what data / how persistent you want it to be.
Just for fun go and check how many things popular websites like Facebook write in the localStorage.

Hope it helps :slight_smile:


#5

As @marmiz says, question is a bit vague, but I think I know what you’re getting at. As PHP is designed to do that, yes. It’s all quite neat, you can have a single PHP file for something this simple - this is the great benefit of PHP, everything is in one place (backend, DB interactions, HTML etc).

A bit of the template would be a form that is input for the database, and a bit of the template would render out values from the database. So if you add something using the form, the page will refresh, and the other bit of the template will render and the page will show what was just added.