I'm building a postcode lookup service that will autocomplete a form and resort to manual input if not found.
I have connected to the SOAP client, pulled in the data but now I need to check the array to see a value has been set and if not then do something else.
So far I have:
$params = array('ah21'=>array('session_id'=>$sessionid,'input'=>"$postcode,$number",'data'=>'STREET_1,HOUSE_1,DISTRICT_LEVEL,ORGANISATION,DISTRICT_2,FORMATTED_PREMISE_NO,TOWN,POSTCODE,COUNTY,COUNTRY'));
$address = $soapclient->__soapCall("ah21",$params);
$address = $address->address;
I need to check if 'HOUSE_1' has a value and if not then show 'STREET_1' instead.
$firstline = NULL;
function checkaddress(){
global $firstline;
if (isset($address->HOUSE_1 )){
$firstline = $address->HOUSE_1;
} else {
$firstline = $address->STREET_1;
}
I'm getting nothing back? Also, if you haven't guessed I'm learning php so any pointers on my code would be a great help.
UPDATE: forgot to mention that I'm printing $firstline elsewhere so appear back into the form.
Aucun commentaire:
Enregistrer un commentaire