📄 edit_offer_buy.php
字号:
{
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_price_cur_id.value == 0)
{
alert('Please choose currency for Price');
frm.sb_price_cur_id.focus();
return(false);
}
if( isNaN(frm.sb_price.value) || frm.sb_price.value<=0)
{
alert('Please specify Price as a non-zero positive number');
frm.sb_price.focus();
frm.sb_price.select();
return(false);
}
return(true);
}
</script>
<form name="form123" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>" onSubmit="return validate_form(this);">
<table width="90%" border="0" align="center" cellpadding="0" cellspacing="0" class="onepxtable">
<tr class="titlestyle">
<td > Edit Buy Offer</td>
</tr>
<tr>
<td><table width="100%" border="0" align="center" cellpadding="2" cellspacing="5" >
<tr valign="top">
<td width="40%" align="right" class="innertablestyle"><font class="normal"><strong>Categories<br>
</strong></font><font class="smalltext">(Max <strong><?php echo $sbrow_gro["sb_cat_cnt"]; ?></strong><?php echo ($sbrow_gro["sb_cat_cnt"]>1)?' categories':' category'; ?>)</font><font class="normal"><strong>
</strong></font></td>
<td width="6"><font class="red">*</font></td>
<td width="60%"> <font class="smalltext">
<textarea name="category" cols="37" rows="5" readonly="readonly" id="category"><? echo $cat_list;?></textarea>
<br>
<select name="cats" id="select2" >
<option value="0">Choose a category</option>
<?
$rs_query=mysql_query("select * from sbbleads_categories order by sb_pid");
while($rst=mysql_fetch_array($rs_query))
{
$cat_path="";
$child=mysql_fetch_array(mysql_query("select * from sbbleads_categories where sb_pid=".$rst["sb_id"]));
if($child)
{
continue;
}
$cat_path.=$rst["sb_cat_name"];
$par=mysql_query("select * from sbbleads_categories where sb_id=".$rst["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"]);
}
?>
<option value="<? echo $rst["sb_id"];?>" ><? echo $cat_path;?></option>
<?
}
?>
</select>
<input name="cid" type="hidden" id="cid" value="<? echo $cid_list;?>">
<input name="add" type="button" id="add" value="Add" onClick="add_category()">
<input name="Remove" type="button" id="Remove" value="Remove" onClick="remove_category()">
</font></td>
</tr>
<tr valign="top">
<td align="right" class="innertablestyle"><font class="normal"><strong>Title</strong></font></td>
<td><font class="red">*</font></td>
<td><font face="Arial, Helvetica, sans-serif" size="2">
<input name="sb_title" type="text" class=select id="sb_title" value="<?php echo $sb_title; ?>" size="30" maxlength="40">
</font></td>
</tr>
<tr valign="top">
<td align="right" class="innertablestyle"><font class="normal"><strong>Description</strong></font></td>
<td><font class="red">*</font></td>
<td valign="middle"> <font class='normal'>
<script language="JavaScript" type="text/javascript">
<!--
<?
$content = $sb_description;
$content = RTESafe($content);
?>//Usage: initRTE(imagesPath, includesPath, cssFile)
initRTE("images/", "", "");
//Usage: writeRichText(fieldname, html, width, height, buttons)
writeRichText('sb_description', '<?=$content?>', 450, 200, true, false);
//uncomment the following to see a demo of multiple RTEs on one page
//document.writeln('<br><br>');
//writeRichText('rte2', 'read-only text', 450, 100, true, false);
//-->
document.write("<br><font class='smalltext'>Description length must not exceed <?php echo $sbrow_con['sb_description_length'];?> characters</font>");
</script>
</font> <noscript>
<p><font class="normal"><b>Javascript must be enabled to use this
form.</b></font></p>
</noscript></td>
</tr>
<tr valign="top">
<td align="right" class="innertablestyle"><font class="normal"><strong>Quantity</strong></font></td>
<td><font class="red">*</font></td>
<td><font face="Arial, Helvetica, sans-serif" size="2">
<input name="sb_quantity" type="text" class=select id="sb_quantity" value="<?php echo $sb_quantity; ?>" size="30" maxlength="40">
</font><font face="Arial, Helvetica, sans-serif" size="2">
</font></td>
</tr>
<tr valign="top">
<td align="right" class="innertablestyle"><font class="normal"><strong>Keywords<br>
</strong></font><font class="smalltext">(Max <strong><?php echo $sbrow_gro["sb_keyword_cnt"]; ?></strong><?php echo ($sbrow_gro["sb_keyword_cnt"]>1)?' keywords':' keyword'; ?>)</font><font class="normal"><strong>
</strong></font></td>
<td><font class="red">*</font></td>
<td><input name="sb_keywords" type="text" class=select id="sb_keywords" value="<?php echo $sb_keywords; ?>" size="30" maxlength="40">
<br> <font class="smalltext">Please specify a comma seperated list
of keywords related to your product. Appropriate keywords will lead
more buyers to find your products.</font></td>
</tr>
<tr valign="top">
<td class="innertablestyle"> <div align="right"><strong><font class="normal">Price</font></strong></div></td>
<td><font class="red">*</font></td>
<td><font face="Arial, Helvetica, sans-serif" size="2">
<select name="sb_price_cur_id">
<option value="0">Select Currency</option>
<?
$rs_query=mysql_query("Select * from sbbleads_currencies where 1" );
while ($rs=mysql_fetch_array($rs_query))
{
?>
<option value="<?php echo $rs["sbcur_id"]; ?>"
<?php
if ( $rs["sbcur_id"]==$sb_price_cur_id)
{
echo " selected ";
}
?>
><?php echo $rs["sbcur_name"]; ?></option>
<?
}
?>
</select>
<input name="sb_price" type="text" id="sb_price" value="<?php echo $sb_price; ?>" size="5" maxlength="30">
</font></td>
</tr>
<tr valign="top">
<td align="right" class="innertablestyle"> </td>
<td> </td>
<td><input name="submit" type="submit" value="Update"> <input name="sb_id" type="hidden" id="sb_id" value="<?php echo $sb_id; ?>">
</td>
</tr>
</table></td>
</tr>
</table>
</form>
<?
} //If showform = No? ends here
}
include_once("template1.php");
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -