创建设置php脚本

I just recently started webdevelopping/programming. And I'm starting to like it now I'm beginning to get the grasps of php programming. Altough I came across a problem I can't fix/don't understand how it possibly can be solved.

I've created a "scroll back to top" button and I'd like switch it on or off on the admin page. That's also the problem. I don't know how to properly do that. Do I have to create a Sql table to store a value and call the value in the button script or is there another way?

Right now the button and jquery function is scripted in a seperate file which I include on the pages where I need the button. I tries to create a form in the admin page which submits a value (on or off) to a config file and the config file is included in the button script file. Right now I feel this isn' the right way to do acheive what i'd like to.

Is there anyone who could help me, and other starting developers facing the same problem, by explaining how this can be acheived or pointing me to some resources/tutorials on how to do such things in PHP?

My gratitude will be of extraterestial magnitude!

Well, it depends if you already have a database. I wouldn't create a database, or even a table just for that. I would consider simply writing an xml file to the file system for something so simple. If you have a multi-user site and need it customer per user, then that would justify a db table since you'll likely be adding more to it later.

If you aren't worried about persisting it between visits to the site, you could just use $_Session: http://php.net/manual/en/reserved.variables.session.php

Maybe even in a cookie if you don't want to do db work and need cross session persistance: http://php.net/manual/en/reserved.variables.cookies.php

Check this for the scrolling question, this isn't php: https://developer.mozilla.org/en-US/docs/DOM/window.scroll

Check this post, it may help: Creating/Writing an XML file in PHP?