I listed all Country names in "countries.php", like:
<?php
$countryArray = array(
'AD'=>array('name'=>'ANDORRA','code'=>'376'),
'AE'=>array('name'=>'UNITED ARAB EMIRATES','code'=>'971'), ...
);
function countrySelector($defaultCountry = "", $id = "", $name = "", $classes = ""){
global $countryArray; // Assuming the array is placed above this function
$output = "<select id='".$id."' name='".$name."' class='". $classes."'>";
$output .= "</select>";
}
using the file in "signup.php", well this works but, what I want to do is to create input (mobile number) in "signup.php", In the mobile input, I want to use a country code when a user chooses a country, It will insert the country code into mobile input. Like: user chose US +1.. in the other input it will show +1(and the user can type their own number without adding the country-code by their self) I have also done the mobile validation properly. I have no idea how to do the code. please help.