Skip to content

PHP: How to allow users to change background color of their profile?

I have made a social networking site. One of the feature I would like to add is to allow users to change the background image of their profile.I have written javascript for it, but once I change background image of one user, all users background change to that image. What should I do to avoid this.

Javascript Code for switching background

Change background option in Settings page


You should load the background image dynamically for each user.

This is just a streamline of what I think you should do:

  1. Create a field in the DB for every user to hold the path for the bg image
  2. Once logged in check if they have that setted on their profile
  3. Change it dynamically using js