0
我想在我的主题选项页面创建动态行,我试图保存序列化数据的那些数据.. 在主题选项页面保存数据WordPress的
我添加工作经验的新行被添加。 。现在我只想保存序列化数据这个值,并相应地命令他们(可以是由起始日期或序列号)
MY jQuery代码
jQuery('a.add-author').click(function(event) {
alert("asdas");
event.preventDefault();
counter++;
var newRow = jQuery('<tr><td><input style="width:200px" type="text" name="designation' + counter + '"/></td>
<td><input style="width:200px" type="text" id="start_date' + counter +'" name="start_date' + counter + '"/></td>
<td><input style="width:200px" id="end_date' + counter +'" type="text" name="end_date' + counter + '"/></td></tr>');
jQuery('table.authors-list').append(newRow);
$("#start_date"+ counter).datepicker();
$("#end_date"+ counter).datepicker();
});
我的选择ARRAY
array(
"name" => "Designation",
"desc" => "Enter your Designation of company.",
"id" => $shortname."_designation",
"type" => "workexp",
"std" => ""
)
我的HTML类型代码workexp
case 'workexp':
?>
<a href="#" title="wrk_exp" class="add-author">Add Work Experience</a>
<table class="authors-list" border="1" bordercolor="#ddd"
style="background-color:#F5F5F5" width="100%" cellpadding="3" cellspacing="3">
<tr><td>Designation</td><td>StartDate</td><td>EndDate</td></tr>
<tr>
<td><input style="width:200px" type="text" name="designation"/></td>
<td><input style="width:200px" type="text" id="start_date" name="start_date"/></td>
<td><input style="width:200px" type="text" id="end_date" name="end_date"/></td>
</tr>
</table>
<?php
break;
我的代码后保存按钮
if ($_GET['page'] == basename(__FILE__)) {
if ('save' == $_REQUEST['action']) {
foreach ($options as $value) {
update_option($value['id'], $_REQUEST[ $value['id'] ]);
}
foreach ($options as $value) {
if(isset($_REQUEST[ $value['id'] ])) {
update_option($value['id'], $_REQUEST[ $value['id'] ] );
} else {
delete_option($value['id']);
}
}
header("Location: admin.php?page=theme-options.php&saved=true");
die;
}
}
你可以更具体和明确与你的答案.. –
你有你的PHP代码的样品,处理后端的形式? – mdelorey
我用我的保存代码更新了我的问题..看看它.. –