store and retrieve serialized HTML

How I can store one o more HTML structure like that in PHP and MYSQL DB,

<li class='ui-state-default ui-sortable full w4-4'>
<div class='element-handler'>
<a href='#edit-element' class='edit revs-edit-element'>Edit</a>
<a href='#del' class='del-element delete'>X</a>
</div>
<div class='element'>
<span class='element-name'>Element name</span>
</div>
<textarea rows='6' cols='10' class='text-shortcode'>
[revs_flexslider page='home'] [shortcode page='home']
[shortcode page='home'][revs_shortcode page='home']
</textarea>
</li>

and retrive it for append in a

Read More
<ul id="contenitore" class="connectedSortable"></ul>

whit serialization

Related posts

Leave a Reply

1 comment

  1. Take the entire structure in php variable.

    $structure = "<li class='ui-state-default ui-sortable full w4-4'>
    <div class='element-handler'>
    <a href='#edit-element' class='edit revs-edit-element'>Edit</a>
    <a href='#del' class='del-element delete'>X</a>
    </div>
    <div class='element'>
    <span class='element-name'>Element name</span>
    </div>
    <textarea rows='6' cols='10' class='text-shortcode'>
    [revs_flexslider page='home'] [shortcode page='home']
    [shortcode page='home'][revs_shortcode page='home']
    </textarea>
    </li>";
    

    then run the sql query

    insert into table (structure) values ('$structure');
    

    to retrieve it just use select statement.

    select * from table_name;
    

    and the output of select in the

    <ul id="contenitore" class="connectedSortable"><?php echo $select_output ?></ul>