如何将文本的值放入表单内的选择器?我需要将 name = sum 的文字发布到<option value="<?php echo $met->request; ?>"<?php if (isset($method) && $method == $met->request && $currentMethod = $met) { echo ' selected="selected"'; $shownext = true; } ?>><?php echo "$met->description - $met->full_summ $met->valute"; ?></option>
这是我的表格
<form id="com_telecomax_buydid" action="
<?php echo JRoute::_('index.php',true); ?>" method="post" onsubmit="return telecomax.complete;">
<input type="hidden" name="option" value="com_telecomax" />
<input type="hidden" name="task" value="payment" />
<h3>
<?php if (isset($cart) && $cart) {?>
<p><?php echo JText::_('COM_TELECOMAX_TOTAL_COST_OF_YOUR_CART'); ?>:<span id="com_telecomax_payment_cart_text"><?php echo $cart.' '.JText::_('COM_TELECOMAX_USD'); ?></span></p>
<?php } ?>
<input type="hidden" name="cart" id="com_telecomax_payment_cart" value="<?php echo isset($cart) && $cart ? 1 : ''; ?>" />
<p><label for="com_telecomax_payment_sum"><?php echo JText::_($cart ? 'COM_TELECOMAX_ADDITIONAL_PAY_FOR_TALK' : 'COM_TELECOMAX_DEPOSIT_FUNDS'); ?>:</label>
<input type="text" class="inp-txt" name="sum" id="com_telecomax_payment_sum" value="<?php echo isset($sum) && $sum ? $sum : $default; ?>" /></p>
<p><?php echo JText::_('COM_TELECOMAX_TOTAL_PAYMENT'); ?>:<span id="com_telecomax_payment_total">
<?php echo isset($sum) && $sum ? $sum : $default; ?>
</span> <?php echo JText::_('COM_TELECOMAX_USD'); ?></p>
</h3>
<p><input type="button" id="com_telecomax_payment_getmethod" value="<?php echo JText::_('COM_TELECOMAX_GET_PAYMENT_METHOD'); ?>" />
<p><label for="com_telecomax_payment_method"><?php echo JText::_('COM_TELECOMAX_PAYMENT_METHOD'); ?>:</label></p>
<p><select name="method" id="com_telecomax_payment_method">
<option value=""<?php if (!isset($method) || !$method) echo ' selected="selected"'; ?> disabled="disabled"><?php echo JText::_('COM_TELECOMAX_PLEASE_SELECT_PAYMENT_METHOD'); ?></option>
<?php foreach($this->methods['data'] as $item) { ?>
<optgroup label="<?php echo $item['title']; ?>">
<?php foreach($item['list'] as $met) { ?>
<option value="<?php echo $met->request; ?>"<?php if (isset($method) && $method == $met->request && $currentMethod = $met) { echo ' selected="selected"'; $shownext = true; } ?>><?php echo "$met->description - $met->full_summ $met->valute"; ?></option>
<?php } ?>
</optgroup>
<?php }
?>
</select><input type="hidden" name="paysum" id="com_telecomax_payment_paysum" value="<?php echo isset($currentMethod) ? "$currentMethod->description@$currentMethod->full_summ@$currentMethod->valute" : '@@'; ?>" /></p>
<p>
<?php if (isset($cart) && $cart) { ?>
<input type="button" value="<?php echo JText::_('COM_TELECOMAX_BACK'); ?>" onclick="location.href='<?php echo JRoute::_('index.php?option=com_telecomax&task=cart',true); ?>'; return false;" />
<?php } ?>
<input type="submit" value="<?php echo JText::_('COM_TELECOMAX_NEXT'); ?>" id="com_telecomax_payment_next" style="display: <?php echo isset($shownext) ? 'block' : 'none' ; ?>;" />
</p>
</form>