📄 edit_product.php
字号:
while($sbrow_off_cat=mysql_fetch_array($sbrs_off_cat))
{
// $cat_id=$rs["cat".$i];
$rs_t=mysql_query("Select * from sbbleads_categories where sb_id =".$sbrow_off_cat["sb_cid"]);
if ($rs_t=mysql_fetch_array($rs_t))
{
$cat_path=$rs_t["sb_cat_name"];
$par=mysql_query("select * from sbbleads_categories where sb_id=".$rs_t["sb_pid"]);
while($parent=mysql_fetch_array($par))
{
$cat_path=$parent["sb_cat_name"].">".$cat_path;
$par=mysql_query("select * from sbbleads_categories where sb_id=".$parent["sb_pid"]);
}
if($cat_list=="")
{
$cat_list=$cat_path;
$cid_list=$rs_t["sb_id"];
}
else
{
$cat_list.=";".$cat_path;
$cid_list.=";".$rs_t["sb_id"];
}
}
}
}
function main ()
{
global $sb_id, $sbrow_con, $sbrow_gro, $errs, $errcnt, $cid_list, $cat_list, $sb_title, $sb_description, $sb_quantity, $sb_keywords, $sb_location, $sb_min_order, $sb_price_cur_id, $sb_price, $sb_samples_available, $sb_product_status, $sb_delivery_time, $sb_payment_mode, $sb_other_mode, $sb_shipping_cost;
$showform="";
if (count($_POST)>0)
{
$cid_list=$_POST["cid"];
$cat_list=$_POST["category"];
if ( $errcnt <> 0 )
{
?>
<table width="90%" border="0" align="center" cellpadding="2" cellspacing="0" class="errorstyle">
<tr>
<td colspan="2"><strong> Your request cannot be processed due to following
reasons</strong></td>
</tr>
<tr height="10">
<td colspan="2"></td>
</tr>
<?
for ($i=0;$i<$errcnt;$i++)
{
?>
<tr valign="top">
<td width="6%"> <?php echo $i+1;?></td>
<td width="94%"><?php echo $errs[$i]; ?></td>
</tr>
<?
}
?>
</table>
<?
}
}
if ($showform<>"No")
{
?>
<script language="JavaScript" type="text/javascript" src="richtext.js"></script>
<script language="JavaScript">
/* function add_category()
{
if(document.form123.cats.value!=0)
{
var id=document.form123.cats.selectedIndex;
if(document.form123.category.value=="")
{
document.form123.cid.value=document.form123.cats.value;
document.form123.category.value=document.form123.cats.options[id].text;
document.form123.category.focus();
document.form123.cats.selectedIndex=0;
}
else
{
document.form123.cid.value=document.form123.cid.value+";"+document.form123.cats.value;
document.form123.category.value=document.form123.category.value+";"+document.form123.cats.options[id].text;
document.form123.category.focus();
document.form123.cats.selectedIndex=0;
}
}
else
{
alert('Choose a Category to add!');
}
}
*/
function add_category()
{
if(document.form123.cats.value!=0)
{
var id=document.form123.cats.selectedIndex;
//////-------checking duplicate category
var cid_list=form123.cid.value.split(";");
var cnt=0;
var posted="no";
while(cnt<cid_list.length)
{
if(cid_list[cnt]==document.form123.cats.value)
{ posted="yes";}
cnt++;
}
if(posted=="yes")
{
alert('This category is already in the list');
return false;
}
//////-------end checking duplicate category
//////-------checking max no. of categories
var sblength;
if(document.form123.category.value == "")
sblength=0;
else
sblength=cid_list.length
if( sblength >= <?php echo $sbrow_gro["sb_cat_cnt"]; ?> )
{
alert("You can't choose more than <?php echo ($sbrow_gro["sb_cat_cnt"]==1)?$sbrow_gro["sb_cat_cnt"].' category':$sbrow_gro["sb_cat_cnt"].' categories'; ?>");
return false;
}
//////-------checking max no. of categories
if(document.form123.category.value=="")
{
document.form123.cid.value=document.form123.cats.value;
document.form123.category.value=document.form123.cats.options[id].text;
document.form123.category.focus();
document.form123.cats.selectedIndex=0;
}
else
{
document.form123.cid.value=document.form123.cid.value+";"+document.form123.cats.value;
document.form123.category.value=document.form123.category.value+";"+document.form123.cats.options[id].text;
document.form123.category.focus();
document.form123.cats.selectedIndex=0;
}
}
else
{
alert('Choose a Category to add');
}
}
function remove_category()
{
var s1=window.document.form123.category.value;
var s2=s1.split(";");
var i=0;
var id=document.form123.cats.selectedIndex;
var s3=document.form123.cats.options[id].text;
var id_list=document.form123.cid.value;
var id_split=id_list.split(";");
var rem_id=document.form123.cats.value;
window.document.form123.category.value="";
window.document.form123.cid.value="";
while(i<s2.length)
{
//alert('Checking '+s2[i]+' nnn with'+s3+' mm');
if(s3==s2[i])
{
//continue;
// alert('Removing'+s3);
}
else
{
if(document.form123.category.value=="")
{
document.form123.category.value=s2[i];
}
else
{
document.form123.category.value=document.form123.category.value+";"+s2[i];
}
}
if(rem_id==id_split[i])
{
//continue;
// alert('Removing'+s3);
}
else
{
if(document.form123.cid.value=="")
{
document.form123.cid.value=id_split[i];
}
else
{
document.form123.cid.value=document.form123.cid.value+";"+id_split[i];
}
}
i++;
}
//window.document.form123.related.value="";
//window.document.form123.rel_id.value="";
}
function validate_form(frm)
{
updateRTEs();
if(frm.cid.value=='')
{
alert('Please choose atleast one category');
frm.cats.focus();
return(false);
}
if(frm.sb_title.value=='')
{
alert('Please specify Title');
frm.sb_title.focus();
return(false);
}
else if(frm.sb_title.value.match(/[&<>]+/))
{
alert("Please remove special characters from Title i.e. & < >");
frm.sb_title.focus();
frm.sb_title.select();
return(false);
}
if(frm.sb_description.value=='')
{
alert('Please specify Description');
return(false);
}
if( isNaN(frm.sb_quantity.value) || frm.sb_quantity.value<=0)
{
alert('Please specify Quantity as a non-zero positive integer');
frm.sb_quantity.focus();
frm.sb_quantity.select();
return(false);
}
if(frm.sb_keywords.value=='')
{
alert('Please specify Keywords');
frm.sb_keywords.focus();
return(false);
}
else if(frm.sb_keywords.value.match(/[&<>]+/))
{
alert("Please remove special characters from Keywords i.e. & < >");
frm.sb_keywords.focus();
frm.sb_keywords.select();
return(false);
}
else
{
var list=frm.sb_keywords.value.split(",");
if( list.length > <?php echo $sbrow_gro["sb_keyword_cnt"]; ?> )
{
alert("You can't choose more than <?php echo ($sbrow_gro["sb_keyword_cnt"]==1)?$sbrow_gro["sb_keyword_cnt"].' keyword':$sbrow_gro["sb_keyword_cnt"].' keywords'; ?>");
frm.sb_keywords.focus();
frm.sb_keywords.select();
return(false);
}
}
if(frm.sb_location.value=='')
{
alert('Please specify Location');
frm.sb_location.focus();
return(false);
}
else if(frm.sb_location.value.match(/[&<>]+/))
{
alert("Please remove special characters from Location i.e. & < >");
frm.sb_location.focus();
frm.sb_location.select();
return(false);
}
if( isNaN(frm.sb_min_order.value) || frm.sb_min_order.value<=0)
{
alert('Please specify Minimum Order as a non-zero positive integer');
frm.sb_min_order.focus();
frm.sb_min_order.select();
return(false);
}
else if( parseInt(frm.sb_min_order.value) > parseInt(frm.sb_quantity.value) )
{
alert("Minimum Order can't be more than Quantity");
frm.sb_min_order.focus();
frm.sb_min_order.select();
return(false);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -