如何使用样式元素以正确的方式将多个值存储到php中的数据库?

Hi this is my html .

<button class="add-div" value="Add Div"/>
<div class="main" style="top:5%; color:red;" >msg1</div>

Here there is a javasript code , that will generate extra div when user clik on button .

The following htl is example out put .

<div class="main" style="top:5%; color:red;" >msg1</div>
<div class="main" style="top:15%; color:white;" >msg2</div>
<div class="main" style="top:25%; color:black;" >msg3</div>
<div class="main" style="top:35%; color:green;" >msg4</div>
<div class="main" style="top:45%; color:yellow" >msg5</div>

Now we need to store this div content and style to databse. But the thing is that , we need to make this all as one entry in the table . [Here there are 5 div . So i need to save these 5 contents into one column and the style of these 5 contents in another column ]

the structure of table is id , div-content , div-style . for the above example the entry is like this

1  msg1,msg2,msg3,msg4,msg5      top:5%;coloe:red;,top15%;color:white;,...

In normal practice everyone will save the entry in one by one . For example

id  div-content  div-style

1    msg1        top:5%; color:red;

2    msg2        top:15%; color:white;

3    msg3        top:25%; color:black;

4    msg4        top:35%; color:green;

5    msg5        top:45%; color:yellow

But in my case i need solution like the following

id    div-content                div-style

1     msg1,msg2,msg3,msg4,msg5   top:5%;coloe:red;,top15%;color:white;,...

Now how can i store this value to database . After saving this value i need to take this value from database and need to get these value in foreach or while loop .Please help .