我有html格式的输入,我需要将它们发送到脚本。它有名字和身份。
<p>
<select onchange="myFunction(this.value)" name="shippcity" id="shippcity">
<option value="0">state</option>
</select>
<input type="hidden" name="calc_shipping_city" id="shipping_city" value="" />// will be removed
</p>
<script>
function myFunction(val) {
if ( val === '' ) {
}
else {
//input val to name="calc_shipping_city" and id="shipping_city"
document.getElementById("shipping_city").value = val;
}
}
</script>
&#13;
这个代码也来自woocomerce:
<?php
}
$my_city = $woocommerce->customer->get_shipping_city();
$my_city = explode('-', $my_city);
if(isset($my_city) && intval($my_city[0]) > 0 ){
?>
set_initial_val('shipp', 'city', <?php echo $my_city[0]; ?>);