У меня есть скрипт PHP и два текстовых поля.Своего рода конвертировать валюту.
Если пользователь хочет купить 1 кредит, который составляет 5 долларов США, используя первое текстовое поле, и при нажатии на вкладку следующее текстовое поле будет автоматически обновляться путем умножения на переменную php.
Можно ли это с помощью простоговстроенный javascript?
Моя переменная PHP - "$ currentValue"
1-й тестовый блок - имя & id = "credit" 2-й текстовый блок - имя & id = "finalRupee"
Пожалуйста, смотрите код ниже в файле function.php
<form action="index.php" method="post" name="userFormJob" onSubmit="return validateForm()" enctype="multipart/form-data">
<table width= "100%">
<tr>
<td colspan="2"><strong><?php echo JText::_( 'PRICE FOR 1 CREDIT' ); ?> = <?php echo $currencytype . ' ' . $currency.' '; ?> <?php echo $price_credit; ?> (Please Note: For One credit value you can post 1 Job for 1 Day)</strong></td>
</tr>
<tr>
<td><p> <b>
<?php
$content = file_get_contents("http://www.xe.com/ucc/convert.cgi?From=USD&To=INR& Amount=1.&template=pca-xetrade");
$content = explode('<TABLE BORDER=0 CELLPADDING=3 CELLSPACING=0>',$content);
$content = str_replace('<TD VALIGN=MIDDLE ALIGN=RIGHT><FONT FACE="Arial,Helvetica"><B>', "", "$content[1]");
$content = explode('<TD COLSPAN=3 ALIGN=CENTER><FONT FACE="Arial,Helvetica" SIZE=-2>',$content);
$toremove = array("a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", ">", "<", "\"", "\'", "=", ",", "/", "-1");
$content = str_replace($toremove, "", "$content[0]");
$final = explode('+1',$content);
$from_code = "USD";
$to_code = "INR";
$currency = $config-> get('currency');
echo '<b>' .$final[0]. ' ' .$from_code. ' =' .$final[1]. ' ' .$to_code. '</b>';
?>
</b></p></td>
</tr>
<tr>
<td><?php echo JText::_( 'BUY' ); ?></td>
<td><input type="text" name="credit" id="credit" class="inputbox" onKeyPress="return isNumberKey(event)" />
<?php
$currentValue = $final[1];
?>
<?php echo JText::_('CREDIT'); ?>
<input name="finalRupee" type="text" class="inputbox" id="finalRupee" onKeyPress="return isNumberKey(event)" value="<?php ?>" readonly /></td>
</tr>
<tr>
<td colspan="2" >Please Use Currency Convert for Dollar to Rupees <a href="http://www.xe.com/ucc/convert.cgi?Amount=1&From=USD&To=INR&template=8n" target="_blank">Click Here</a></td>
</tr>
<tr>
<td colspan="2" ><b><?php echo JText::_('BILLING ADDRESS'); ?></b></td>
</tr>
<tr>
<td><?php echo JText::_('ADDRESS'); ?></td>
<td><input class="inputbox" type="text" name="address" id ="address" size="40" maxlength="255" value="<?php echo $row->bill_addr; ?>"/></td>
</tr>
<tr>
<td><?php echo JText::_('ADDRESS CONT'); ?>:</td>
<td><input class="inputbox" type="text" size="40" maxlength="255" name="address_cont" id ="address_cont" value="<?php echo $row->bill_addr_cont; ?>"/></td>
</tr>
<tr>
<td><?php echo JText::_('CITY'); ?>: </td>
<td><input class="inputbox" type="text" name="city" id ="city" value="<?php echo $row->bill_city; ?>"/></td>
</tr>
<tr>
<td><?php echo JText::_('STATE'); ?>:</td>
<td><input class="inputbox" type="text" name="state" id ="state" value="<?php echo $row->bill_state; ?>"/></td>
</tr>
<tr>
<td><?php echo JText::_('COUNTRY'); ?>:</td>
<td><?php
$list_country = getSelectCountry('id_country',$row->bill_id_country,'');
echo $list_country;
?></td>
</tr>
<tr>
<td><?php echo JText::_('ZIP POSTAL'); ?>:</td>
<td><input class="inputbox" type="text" name="zip" id ="zip" value="<?php echo $row->bill_zip; ?>"/></td>
</tr>
<tr>
<td><?php echo JText::_('PHONE'); ?>:</td>
<td><input class="inputbox" type="text" name="phone" id ="phone" value="<?php echo $row->bill_phone; ?>"/></td>
</tr>
<tr>
<td><?php echo JText::_('PAYMENT'); ?>:</td>
<td><select name="mode_pay">
<option value="m"><?php echo JText::_('MANUAL'); ?> / <?php echo JText::_('TRANSFER'); ?></option>
<option value="p">PayPall Secure Pay</option>
</select></td>
</tr>
<tr>
<td colspan="2"> </td>
</tr>
<tr>
<td colspan="2"><center>
<img src="http://www.jobodisha.com/images/stories/powered_by.png" alt="Pay Pal Secure Payments" width="497" height="149" align="absmiddle">
</center></td>
</tr>
</table>
<input type="submit" value="<?php echo JText::_( 'BUY' ); ?>" class="button" />
<input type="hidden" name="option" value="<?php echo $option; ?>" />
<input type="hidden" name="task" value="savebuycredit" />
<input type="hidden" name="boxchecked" value="0" />
<?php echo JHTML::_('form.token'); ?>
</form>