Nice interface. What i should do:
The database structure:
Store tabs hierarchical in: {tabid}|{parentid}|{tabname}
Store text and images in: {id}|{tabid}|{content}|{type}
The html structure:
Build one form and put your tab structure in it. Maybe take a look at: http://twitter.github.io/bootstrap/javascript.html#tabs
example:
<form method="post" action="savetabbedinterface">
<ul class="nav nav-tabs" id="myTab">
<li class="active"><a href="#home">Home</a></li>
<li><a href="#profile">Profile</a></li>
<li><a href="#messages">Messages</a></li>
<li><a href="#settings">Settings</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="home">...</div>
<div class="tab-pane" id="profile">...</div>
<div class="tab-pane" id="messages">...</div>
<div class="tab-pane" id="settings">...</div>
</div>
</form>
When your form will be submit all the tabs content will be saved once.
Use form inputs with indices (array(s) of arrays) see: How to POST data as an indexed array of arrays (without specifying indexes)
Actions:
When the user adds a tab:
-add a hidden field to the form with: name="tabs[0][{numberoftabs+1}]" value="{tabname}"
When the user adds a sub tab:
-add a hidden field to the form with: name="tabs[parenttabid][{numberofsubtabsforthisparent+1}]" value="{tabname}"
-create a content
When the user adds a image box:
add a to the content with name="images[{tabid}][]"
When the user adds a text box:
add a to the content with name="texts[{tabid}][]">
Use javascript or jQuery to add this elements dynamically.
When the form has been submit you can iterate the $_POST['tabs'], etc to store the information of the interface.
In stead of {numberoftabs+1} you can also use a empty array [] you have to save the order of your tabs in that case after submit.
Form field indices with only number can cause problems. Add a char before the numbers to prevent this: name="tabs[p0][t{numberoftabs+1}]"
Good luck
Update:
I generate a prototype for adding and saving tabs, see: http://bootply.com/61771. The prototype uses Twitter Bootstrap and jQuery.
Adding tabs and sub tabs will generate the form like:
<input type="hidden" value="Tab 1" name="tabs[p0][t1]">
<input type="hidden" value="Tab 2" name="tabs[p0][t2]">
<input type="hidden" value="Tab 3" name="tabs[p0][t3]">
<input type="hidden" value="SubTab 1" name="tabs[p2][t1]">
<input type="hidden" value="SubTab 2" name="tabs[p2][t2]">
<input type="hidden" value="SubTab 3" name="tabs[p2][t3]">
<input type="hidden" value="SubTab 1" name="tabs[p1][t1]">
<input id="savebutton" class="btn" type="submit" value="save interface">
After submit the form you could use php to save the input, print_r[$_POST]
:
Array ( [tabs] => Array ( [p0] => Array ( [t1] => Tab 1 [t2] => Tab 2 [t3] => Tab 3 ) [p2] => Array ( [t1] => SubTab 1 [t2] => SubTab 2 [t3] => SubTab 3 ) [p1] => Array ( [t1] => SubTab 1 ) ) )