当我在管理端添加任何产品时,除产品详细信息外,所有选项都在产品页面中更新
以下是addproduct页面的代码。请帮帮我
<?php
include('includes/init.php');
checkSession();
$subcats=$superadmin->getAllSubcats();
$cats=$superadmin->getAllcats();
//$allpkgs=$pkg_class->getAllPkgs();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Admin Ajwa Fruit</title>
<link rel="stylesheet" href="css/screen.css" type="text/css" media="screen" title="default" />
<!--[if IE]>
<link rel="stylesheet" media="all" type="text/css" href="css/pro_dropline_ie.css" />
<![endif]-->
<!-- jquery core -->
<script src="js/jquery/jquery-1.4.1.min.js" type="text/javascript"></script>
<script type="text/javascript" src="includes/tinymce/tinymce.min.js"></script>
<script type="text/javascript">
tinymce.init({
selector: "textarea",
plugins: "code"
});
</script>
<!-- UploadiFy -->
<link href="includes/uploadify/uploadify.css" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="includes/uploadify/swfobject.js"></script>
<script type="text/javascript" src="includes/uploadify/jquery.uploadify.v2.1.4.min.js"></script>
<!-- UploadiFy Ends-->
<!-- datepicker -->
<link rel="stylesheet" href="includes/datepicker/jquery.ui.all.css">
<script src="includes/datepicker/jquery.ui.core.js"></script>
<script src="includes/datepicker/jquery.ui.widget.js"></script>
<script src="includes/datepicker/jquery.ui.datepicker.js"></script>
<link rel="stylesheet" href="includes/datepicker/demos.css">
<!-- datepicker -->
<!-- fancybox-->
<script type="text/javascript" src="includes/fancybox/jquery.mousewheel-3.0.2.pack.js"></script>
<script type="text/javascript" src="includes/fancybox/jquery.fancybox-1.3.1.pack.js"></script>
<link rel="stylesheet" type="text/css" href="includes/fancybox/jquery.fancybox-1.3.1.css" media="screen" />
<!-- fancybox-->
<!-- MUST BE THE LAST SCRIPT IN <HEAD></HEAD></HEAD> png fix -->
<script type="text/javascript">
$(document).ready(function(){
$( "#eventdate" ).datepicker();
jQuery('#logout').mouseover(function(){
jQuery(this).css('cursor','pointer');
})
jQuery('#logout').click(function(){
//ajax
$.ajax({
type : "POST",
cache : false,
url : '<?='logout.php'?>',
data : '',
success: function(data)
{
if(data =='1')
{
window.location = "index.php";
//alert('hi');
}
}
});
//ajax
})
//uploadify
$('#mainimage').uploadify({
'uploader' : 'includes/uploadify/uploadify.swf',
'script' : 'includes/uploadify/mainuploadify.php',
'cancelImg' : 'includes/uploadify/cancel.png',
'folder' : 'images/event_imgs/',
'auto' : false,
'width' : 128,
'height' : 128,
'fileExt' : '*.jpg;*.gif;*.png',
'fileDesc' : 'Image Files',
'buttonImg' : 'images/uploads-icon.png',
'multi' : false,
'onSelect' : function(event,ID,fileObj) {
var nooffiles = parseInt($("#mfcounter").val())+1
$("#mfcounter").val( nooffiles)
//alert($("#mfcounter").val());
},
'onCancel' : function(event,ID,fileObj,data) {
var nooffiles = parseInt($("#mfcounter").val())-1
$("#mfcounter").val( nooffiles)
alert('The queue has been cleared.');
},
'onComplete' : function(event, ID, fileObj, response, data) {
// var responseparts = response.split("|");
$.fancybox.hideActivity();
alert(response);
window.location.href="products.php";
}
});
//uploadify
jQuery('#btn_add').live('click',function(){
$.fancybox.showActivity();
$.ajax
({
type : "POST",
cache : false,
url : $("#formID").attr('action'),
data : $("#formID").serializeArray(),
success: function(data)
{
var response = data.split("|")
if(parseInt($("#mfcounter").val())>0)
{
$('#mainimage').uploadifySettings("scriptData", {'id':response[1]});
$('#mainimage').uploadifyUpload();
// alert(response[1]);
}
else
{alert("Record added successfully.");
window.location.href="products.php";
}
//location.reload();
}
});
})
jQuery('#maincat').live('change',function(){
var val=jQuery('#maincat option:selected').val();
// jQuery('#subcatdiv').html(val);
//ajax
$.ajax({
type : "POST",
cache : false,
url : 'getsubcats.php',
data : 'id='+val,
success: function(data)
{
jQuery('#subcatdiv').html(data);
}
});
//ajax
})
});
</script>
</head>
<body>
<!-- Start: page-top-outer -->
<div id="page-top-outer">
<!-- Start: page-top -->
<div id="page-top">
<!-- start logo -->
<div style="float:left; padding-top:10px;">
<img src="../images/logo.png" width="219" height="66" />
</div>
<!-- end logo -->
<!-- start top-search -->
<div id="top-search"></div>
<!-- end top-search -->
<div class="clear"></div>
</div>
<!-- End: page-top -->
</div>
<!-- End: page-top-outer -->
<div class="clear"> </div>
<!-- start nav-outer-repeat................................................................................................. START -->
<div class="nav-outer-repeat">
<!-- start nav-outer -->
<div class="nav-outer">
<!-- start nav -->
<?php include('menu.php'); ?>
<!-- start nav -->
</div>
<div class="clear"></div>
<!-- start nav-outer -->
</div>
<!-- start nav-outer-repeat................................................... END -->
<div class="clear"></div>
<!-- start content-outer ........................................................................................................................START -->
<div id="content-outer">
<div id="content">
<!-- start page-heading -->
<div id="page-heading">
<h1>Add new Product</h1>
</div>
<!-- end page-heading -->
<table border="0" width="100%" cellpadding="0" cellspacing="0" id="content-table">
<tr>
<th rowspan="3" class="sized"><img src="images/shared/side_shadowleft.jpg" width="20" height="300" alt="" /></th>
<th class="topleft"></th>
<td id="tbl-border-top"> </td>
<th class="topright"></th>
<th rowspan="3" class="sized"><img src="images/shared/side_shadowright.jpg" width="20" height="300" alt="" /></th>
</tr>
<tr>
<td id="tbl-border-left"></td>
<td><!-- start content-table-inner ...................................................................... START -->
<div id="content-table-inner">
<!-- start table-content -->
<div id="table-content">
<!-- start message-yellow --><!-- end message-yellow -->
<!-- start message-red --><!-- end message-red -->
<!-- start message-blue --><!-- end message-blue -->
<!-- start product-table ..................................................................................... --><!-- end product-table................................... -->
<form action="postdata.php" method="post" id="formID">
<input type="hidden" name="mfcounter" value="0" id="mfcounter" />
<table width="500" border="0" cellpadding="1" cellspacing="1">
<tr>
<th height="40" align="left">Product Title:</th>
<td> <input type="text" class="inp-form" name="edata[event_title]" id="etitle" /></td>
</tr>
<tr>
<th height="41" valign="top" align="left">Product Detail:</th>
<td> <p>
<textarea class="" id="edesc" name="pdata" ></textarea>
</p>
<p> <span style="font-size:10px; color:#F00">Leave blank detail if category for product</span> </p></td>
</tr>
<tr>
<th height="45" align="left">Category:</th>
<td><select class="styledselect" name="edata[maincategory_id]" id="maincat">
<option value="0">Select</option>
<?php
if(is_array($cats))
{foreach($cats as $eachcats)
{
echo "<option value='".$eachcats['id']."'>".$eachcats['cat_name']."</option>";
}
}
?>
</select></td>
</tr>
<tr>
<th height="45" align="left">Sub Category:</th>
<td>
<div id="subcatdiv">
<select class="styledselect" disabled="disabled" name="edata[category_id]">
<option value="0">Select</option>
<?php
if(is_array($subcats))
{foreach($subcats as $eachcat)
{
echo "<option value='".$eachcat['id']."'>".$eachcat['title']."</option>";
}
}
?>
</select>
</div>
</td>
</tr>
<tr>
<th align="left">Price:</th>
<td><!--<input type="text" class="inp-form" name="edata[edate]" id="eventdate" />-->
<input type="text" class="inp-form" name="edata[price]" id="" />
</td>
</tr>
<tr>
<th height="57" align="left">Upload Image:</th>
<td valign="bottom">
<input type="file" name="mainimage" id="mainimage"/>
</td>
</tr>
<th></th>
<td><input type="button" class="form-submit" id="btn_add" value="Add New User" /></td>
</tr>
</table>
</form></div>
<!-- end content-table -->
<!-- start paging..................................................... --><!-- end paging................ -->
<div class="clear"></div>
</div>
<!-- end content-table-inner ............................................END --></td>
<td id="tbl-border-right"></td>
</tr>
<tr>
<th class="sized bottomleft"></th>
<td id="tbl-border-bottom"> </td>
<th class="sized bottomright"></th>
</tr>
</table>
<div class="clear"> </div>
</div>
<!-- end content -->
<div class="clear"> </div>
</div>
<!-- end content-outer........................................................END -->
<div class="clear"> </div>
<!-- start footer -->
<?php include("footer.php") ?>
<!-- end footer -->
</body>
</html>
我是初学者请在这方面帮助我
答案 0 :(得分:0)
我已经看到所有其他字段名称都是数组,例如edata []而pdata不是数组格式。