Thanks Spike it outputs the conversion rate on the action page but it doesn't do the multiplication. The results of the following var_dumping:
PHP Code:
var_dump( $fConversionRate );
var_dump( $_GET['ValuetoConvert']);
is:
float(1.1857) NULL
It seems as if maybe the value isn't being passed from the form.php ValueToConvert field? Why is this not working? Thank-you
Form.php
PHP Code:
<?php
require_once 'lib/nusoap.php';
$oClient = new nusoap_client(
'http://www.webservicex.net/CurrencyConvertor.asmx?WSDL',
TRUE // Needs to be TRUE because we are using WSDL
);
?>
<form action="action.php" method="get">
<p>
Convert from:
<select name="FromCurrency">
<option value="USD">UnitedStatesDollar</option>
</select>
</p>
<p>
convert to:
<select name="ToCurrency">
<option value="CAD">CanadianDollar</option>
</select>
</p>
Value to convert:<input type="text" name="ValueToConvert" /><br />
<input type="submit" />
</form>
Action.php
PHP Code:
<?php
require_once 'lib/nusoap.php';
$oClient = new nusoap_client(
'http://www.webservicex.net/CurrencyConvertor.asmx?WSDL',
TRUE // Needs to be TRUE because we are using WSDL
);
$oResponse = $oClient->call(
'ConversionRate',
array(
'FromCurrency' => $_GET['FromCurrency'],
'ToCurrency' => $_GET['ToCurrency']
)
);
$fConversionRate = (float) $oResponse['ConversionRateResult']; $result =
$fConversionRate * isset($_GET['ValuetoConvert']) ? $_GET['ValuetoConvert'] : 0;echo
$fConversionRate;echo $result;
?>
Bookmarks