How to send the value of the select drop-down box to the ID to implement the code

Time:2021-4-17

The complete code is as follows
HTML code:

Copy code

The code is as follows:

<!–
EOT;
if($step==1){
print <<<EOT –>
<div>
<form name=”form_order” method=”post” action=”?action=$atc” enctype=”multipart/form-data”>
<div>
<div>
<!–
EOT;
$total_all=0;
$jinbi_all=0;
foreach($listdb AS $name=>$array){
$total=0;
$jinbi=0;
print <<<EOT
–>
<ul>
<li>< div > < input type = “checkbox” name = “checked =” checked / > select all < / div ></li>
<li>Merchandise</li>
<li>Back integral</li>
<li>Quantity</li>
<li>Unit price</li>
<li>Total price</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); / / filter out the HTML code
$content=preg_ Replace (‘/ || / is’,’ “, $content); / / remove the extra space $content = get_ word($content,100);
$total+=$rs[price2];
$total_all+=$rs[price2];
$jinbi+=$rs[jinbi2];
$jinbi_all+=$rs[jinbi2];
print <<<EOT
–>
<ul>
<li><input type=”checkbox” name=”” checked=”checked” /></li>
<li><a href=”bencandy.php?city_id=$rs[city_id]&fid=$rs[fid]&id=$rs[id]” 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>0 points</li>
<li>{$rs[num]}</li>
<li>< font > {$RS [price]} < / font > yuan < / Li > < li > < font > {$RS [price]} < / font > yuan < / Li > < / UL >
<!–
EOT;
}print <<<EOT
–>
<ul>
<div>
<p>
Mode of delivery:
<!–
EOT;
if($rs[youfei]==”1″){print <<<EOT
–>
<select name=”postdb[youfei]” onchange=”Add(this.value,’total$rs[uid]’)”>
< option value ‘=’10’ > express: 10 yuan < / option >
<option value=’20’> EMS:20 Yuan < / option >
Ordinary mail: 50 yuan < / option >
</select>
<SCRIPT LANGUAGE=”JavaScript”>
<!–
function changenum(price,type,id,uid){
price=parseFloat(price);
num = parseInt($(“#numid”+id).val());
If (type = = 1) {/ / increase
num++; }
Else if (type = = – 1) {/ / decrease
num–; }
Else if (type = = 0) {/ / delete
num=0 }
if(type!=0 && num==0){
Alert (‘quantity cannot be less than 1, if you don’t want to buy, please select Delete ‘);
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>< strong > total store merchandise:
< / strong > (including freight) < font > $total < / font > yuan</p>
</div>
<div>
<p>< stron > seller: {$RS [username]} < / strong ></p>
<p>Leave a message to the seller: < textarea name =’postdb [content]’id =’atc_ content’ >$rsdb[content]</textarea></p>
</div>
</ul>
<!–
EOT; }print <<<EOT
–>
<!–
EOT;
if(count($listdb)>1){
print <<<EOT
–>
< UL > < div > < strong > total price of goods: < / strong > (including freight) < font > $total_ All < / font > yuan < / div > < / UL > <! — EOT;}
print <<<EOT
–>
</div>
</div>
<div></div> <div>
<div>
<div>
<p>< span > actual payment:</span>
<!–
EOT;
if(count($listdb)>1){
print <<<EOT
–>
<font>$total_ Ll < / font > yuan
<!–
EOT; }
else{print <<<EOT
–>
< font > $total < / font > yuan
<!–
EOT;
}print <<<EOT
–> </p> {$address_selects}
</div>
</div>
<div>
<input type=”submit” name=”imageField” 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]” size=”50″ value=”$infodb[title]”> </div>
<!–
EOT;
if($job==’edit’){print <<<EOT
–>
<SCRIPT LANGUAGE=”JavaScript”>
<!–
$(document).ready(function(){
$(“#othermore”).show();$(“#dobutton”).hide();
});
//–>
</SCRIPT>
To delete, please click onclick = “return confirm (‘are you sure you want to delete it? ‘”; > delete</a>
<!–
EOT;
}print <<<EOT
–>
</div>
<script language=”JavaScript”>
<!–
function chooseAddress(selObj){
value = selObj.options[selObj.selectedIndex].value;
if(value==’-1′){
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)!=-1){
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>
</div>
</div>
<!–
EOT;
?>
–>

What is the desired effect
When I select ems20 freight, when I click the freight in the drop-down box in the mode of delivery, I use the total price of the store + 20 yuan. When I click 50 yuan by surface mail, the total price of the store + 50 yuan
I said two places to display, because if there are goods from two different businesses, there will be the total price of the two businesses and the total price of the goods themselves.
The solution is as follows

Copy code

The code is as follows:

<select name=”postdb[youfei]” onchange=”Add(this.value,’total$rs[uid]’)”>
< option value ‘=’10’ > express: 10 yuan < / option >
<option value=’20’> EMS:20 Yuan < / option >
Ordinary mail: 50 yuan < / option >
</select>

Operate the name = “postdb [Youfei]” attribute, set the parameter named postdb [Youfei] in the action, that is: private string postdb [Youfei], and then generate the get / set method to get the value!