I have the function below in the functions.php files
function get_ADRESS(){
if(isset($_POST['getcep']) and $_SERVER['REQUEST_METHOD'] == "POST"){
$cep = escape($_POST['cep']); //10
$cep = preg_replace("/[^0-9]/", "", $cep);
$url = "http://viacep.com.br/ws/$cep/xml/";
$xml = @simplexml_load_file($url);
echo $xml;
}
}
}
$XML
is an array that returns me zip, street, uf, number. What do I need to run the get_endereco function on the register.php page and then enter those values in the HTML below, how do I do that?
<div class="form-group">
<div class="col-lg-10">
<input type="text" class="form-control" placeholder="Endereço" id="cep_load" name="cep_load" value="{$cep}">
</div>
</div>
<div class="form-group">
<div class="col-lg-10">
<input type="text" class="form-control" placeholder="Endereço" id="address" name="address" value="{$rua}">
</div>
</div>
<div class="form-group">
<div class="col-lg-10">
<input class="form-control" id="city" name="city" placeholder="Cidade" value="{$cidade}" >
</div>
</div>