Question: This is the problem I have: I am making a CSS editor for website administrators, but only for certain styles. What I need is a way to find a word or a phrase in the CSS file (the title of the style), and then change its content. So, in other words, if I have this code:

```
.test_style {
font-size:12px;
color:#ffffff;
}

```

and the administrator chooses the style 

> 
> test\_style
> 
> 
> 

and writes this:

```
font-size:16px;
color:#000000;
font-weight:bold;
margin-top:5px;

```

the PHP script should find the corresponding style, and change the content to this:

```
.test_style {
font-size:16px;
color:#000000;
font-weight:bold;
margin-top:5px;
}

```

Does anyone have any ideas how I could do this?

EDIT: My idea is to let administrators choose a selector from a drop-down menu, write the code in a textarea, and then save the code they write into that specific style in the CSS file.

Answer: 
you can use the same idea on this site: <http://www.barelyfitz.com/projects/csscolor/>

I copied the link from: [Using PHP as a CSS file?](https://stackoverflow.com/questions/9361696/using-php-as-a-css-file)

all you have to do is use db to store actual css content in a text field
You can do this with a database. Create a database in `mysql` with a table. Make a column for selector and another column for styling so that the table will look like;

```
---------------------------------
| selector   | style            |
---------------------------------
|.test_style | font-size:12px;  |
|            | color:#ffffff;   |
---------------------------------

```

You may `echo` this data to your php file to display. When admin changes the style, you may update the style field, looking for `.test_style` as the key. You may try jQuery + AJAX to send and receive data avoiding a form or page reload.