Hi! I have question, is it possible from web page change information in php file? If it is then how? I tryed search google, but nothing.

For exemple : I open settings page in my browser and there i have section Background color : <and here have input tag> and if i write into the input tag #FFF000 and press save, it's change color code example in some of the page in <body bgcolor="#FFF332(Here)"> tag.

I have seen this in CMS, and i want add to my page.

With regards,
Blaaam.

Member Avatar for diafol

This could be done via DATABASE - save changes to DB and build a dynamic style profile via php (in <style> tags).

Hard-coding inline styles should be discouraged, with styling and layout being left to CSS (and possibly js). The html should be as clean from clutter and attributes as possible. (My opinion)

Anyway, you could do something like this:

<style>
  body{
    background-color: <?php echo $bgc;?>;
  }
</style>

Where, $bgc is the background colour, either taken from the DB or from a passed/stored variable ($_GET or $_POST or $_COOKIE or $_SESSION).

You could also write to a file (e.g. css) directly with file_get_contents and file_put_contents or similar.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.