怎样把select往下拉框的值传到id中完成编码

详细的编码以下
HTML code:

拷贝编码
编码以下:

<!--
EOT;
if($step==1){
print <<<EOT -->
<div class="main">
<form name="form_order" method="post" action="?action=$atc" enctype="multipart/form-data">
<div class="shopcartbox">
<div class="shopcart2">
<!--
EOT;
$total_all=0;
$jinbi_all=0;
foreach($listdb AS $name=>$array){
$total=0;
$jinbi=0;
print <<<EOT
-->
<ul class="u1">
<li class="l1"><div><input type="checkbox" name="" id="" checked="checked" /> 全选</div></li>
<li class="l2">产品</li>
<li class="l3">返積分</li>
<li class="l4">数量</li>
<li class="l5">单价</li>
<li class="l6">总价</li>
</ul>
<!--
EOT;
foreach($array AS $rs){ $
rs[picurl]=$rs[picurl]?$rs[picurl]:"$webd[www_url]/images/default/nopic.jpg";
$rs[picurl]=tempdir($rs[picurl]);
@extract($db->get_one("SELECT content FROM {$_pre}content_$rs[mid] WHERE id=$rs[id]"));
$content=preg_replace('/<([^<]*)>/is',"",$content); //把HTML编码过虑掉
$content=preg_replace('/ | | /is',"",$content); //把过剩的空格除去掉 $content= get_word($content,100);
$total+=$rs[price2];
$total_all+=$rs[price2];
$jinbi+=$rs[jinbi2];
$jinbi_all+=$rs[jinbi2];
print <<<EOT
-->
<ul class="u2" id="tr$rs[id]">
<li class="l1"><input type="checkbox" name="" id="" checked="checked" /></li>
<li class="l2"><a href="bencandy.php?city_id=$rs[city_id]&fid=$rs[fid]&id=$rs[id]" class="pic" target="_blank"><img src="$rs[picurl]"height="90" onError="this.src='$webdb[www_url]/images/default/nopic.jpg'"/></a><h3><a href="bencandy.php?city_id=$rs[city_id]&fid=$rs[fid]&id=$rs[id]" target="_blank">$rs[title]</a></h3><p>$rs[content]</p></li>
<li class="l3">0分</li>
<li class="l4">{$rs[num]}</li>
<li class="l5"><font>{$rs[price]}</font>元</li> <li class="l6"><font id="showid$rs[id]" class="shows$rs[uid]">{$rs[price2]}</font>元</li> </ul>
<!--
EOT;
}print <<<EOT
-->
<ul class="u3">
<div class="fr">
<p class="p1">
运输方法:
<!--
EOT;
if($rs[youfei]=="1"){print <<<EOT
-->
<select id="collect" name="postdb[youfei]" onchange="Add(this.value,'total$rs[uid]')">
<option value='10'>快递:10元</option>
<option value='20'>EMS:20元</option>
<option value='50'>平邮:50元</option>
</select>
<SCRIPT LANGUAGE="JavaScript">
<!--
function changenum(price,type,id,uid){
price=parseFloat(price);
num = parseInt($("#numid"+id).val());
if(type==1){ //提升
num++; }
else if(type==⑴){ //降低
num--; }
else if(type==0){ //删掉
num=0 }
if(type!=0 && num==0){
alert('数量不可以小于1,若不想选购,请挑选删掉');
num=1; }
$("#numid"+id).val(num);
$("#showid"+id).html(changeTwoDecimal(String(num*price))); obj=$(".shows"+uid);
thispice = 0;
for(i=0;i<obj.size();i++){
thispice+=parseFloat(obj.eq(i).html()); }
$("#total"+uid).html(thispice); if(type==0){
$.get("join.php?type=setcookie&cid="+id+"&num="+0); $("#tr"+id).hide(); }else{
$.get("join.php?type=setcookie&cid="+id+"&num="+num+"&"+Math.random()); } obj2 = $(".totalprice");
if(obj2.size()>1){ thispice = 0; for(i=0;i<obj2.size();i++){
thispice+=parseFloat(obj2.eq(i).html()); }
$("#total_all").html(thispice); } }
function changeTwoDecimal(x){
var f_x = parseFloat(x);
if(isNaN(f_x)){
alert('function:changeTwoDecimal->parameter error');
return false; }
var f_x = Math.round(x*100)/100; return f_x; }
function Add(m,id){ document.getElementById(id).innerHTML = parseInt(document.getElementById(id).getAttribute("total")+parseInt(m)) //--> </SCRIPT>
<!--
EOT; }
print <<<EOT
-->
</p>
<p class="p2"><strong>店面产品累计:
</strong>(含运费) <font id="total$rs[uid]" class="totalprice">$total</font>元</p>
</div>
<div class="fl">
<p class="p1"><stron>商家:{$rs[username]}</strong></p>
<p class="p2">给商家留言:<textarea name='postdb[content]' id='atc_content' >$rsdb[content]</textarea></p>
</div>
</ul>
<!--
EOT; }print <<<EOT
-->
<!--
EOT;
if(count($listdb)>1){
print <<<EOT
-->
<ul class="u4"><div><strong>产品总价:</strong>(含运费) <font id="total_all">$total_all</font>元</div></ul> <!-- EOT; }
print <<<EOT
-->
</div>
</div>
<div class="clear20"></div> <div class="shoppostbox">
<div class="shoppostdiv">
<div class="shopinfo">
<p><span>实支付:</span>
<!--
EOT;
if(count($listdb)>1){
print <<<EOT
-->
<font id="total$rs[uid]" class="totalprice">$total_ll</font>元
<!--
EOT; }
else{print <<<EOT
-->
<font id="total$rs[uid]" class="totalprice">$total</font>元
<!--
EOT;
}print <<<EOT
--> </p> {$address_selects}
</div>
</div>
<div class="shop_postbtn">
<input type="submit" name="imageField" id="imageField" class="shop-submit" value=" " /> <input type="hidden" name="fid" value="$fid"> <input type="hidden" name="id" value="$id"> <input type="hidden" name="cid" value="$cid"> <input type="hidden" name="postdb[title]" id="atc_title" size="50" value="$infodb[title]"> </div>
<!--
EOT;
if($job=='edit'){print <<<EOT
-->
<SCRIPT LANGUAGE="JavaScript">
<!--
$(document).ready(function(){
$("#othermore").show();$("#dobutton").hide();
});
//-->
</SCRIPT>
<a href="?action=del&id=$id&cid=$cid&fid=$rsdb[fid]" onClick="return confirm('你确定要删掉吗?');">删掉</a>
<!--
EOT;
}print <<<EOT
-->
</div>
<script language="JavaScript">
<!--
function chooseAddress(selObj){
value = selObj.options[selObj.selectedIndex].value;
if(value=='⑴'){
ifHideMoreTr(false); }
else{ ifHideMoreTr(true);
}
}
function ifHideMoreTr(type){
var arr = ["username","phone","mobphone","email","qq","postcode","address" ];
$("#othermore input").each(function (i){
if(jQuery.inArray(this.name.replace(/postdb\[order_([\w]+)\]/, "$1"),arr)!=⑴){
obj=$(this).parent().parent();
if(type==true){
obj.hide()
}else{ obj.show()
}
}
});
}
$(document).ready(function(){
sObj = $("#choose_Address");
if(sObj.get(0).options.length==1||"$job"=="edit"){
sObj.parent().parent().hide
ifHideMoreTr(false);
}
else{ ifHideMoreTr(true);
}
});
//-->
</script>
</form>
</div>
<!--
EOT;
} print <<<EOT
-->
<div class="clear20">
</div>
</div>
<!--
EOT;
?>
-->

要想的实际效果是
当我挑选ems20运费时间,在运输方法中点一下往下拉框中的运费时间那末就用 店面累计总价+ 20元 当我点一下平邮50元时,店面累计总价+ 50元.
我说的要2个地区显示信息,是由于他假如存在2个不一样的商家的产品时,会有2个商家合起来的总价和 商家产品自身的总价。
处理方式以下

拷贝编码
编码以下:

<select id="collect" name="postdb[youfei]" onchange="Add(this.value,'total$rs[uid]')">
<option value='10'>快递:10元</option>
<option value='20'>EMS:20元</option>
<option value='50'>平邮:50元</option>
</select>

对name=”postdb[youfei]“特性开展实际操作,在action中设定名为postdb[youfei]的主要参数,即:private String postdb[youfei],随后转化成get/set方式,便可以取到值了!