I like script using countries like https://intl-tel-input.com/
How to get POST value also for the specific country as it is a separate value?
<input id="phone" class="form-control" autocomplete="off" placeholder="(XXX) 555-0123" type="tel">
I like script using countries like https://intl-tel-input.com/
How to get POST value also for the specific country as it is a separate value?
<input id="phone" class="form-control" autocomplete="off" placeholder="(XXX) 555-0123" type="tel">
use getSelectedCountryData
and put it in another input
Will this be the correct code?
//HTML
<input type="tel" id="phone">
<input id="phonefull" type="hidden" name="phonenumber">
<input id="callingcode" type="hidden" name="callingcode">
//Javascript
$("#calling_code").val($("#phone").intlTelInput("getSelectedCountryData").dialCode);
//PHP
$_REQUEST['phonenumber']
$_REQUEST['callingcode']
Does it do what you expected it to do?
function send_name(selectObjectI) {
var value = selectObjectI.value;
$.ajax({
type: "POST",
url: "http://localhost/php/protected/form_addnews.php",
data:{c_php_value: value}
});
function send_name(selectObjectI) {
var value = selectObjectI.value;
$.ajax(
{
type: "POST",
url: "http://localhost/php/protected/form_addnews.php",
data: {c_php_value: value}
}
);
}
did you try it?
This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.