Here is the .php file, I have made a website via smarty template and the form is surprisingly submitting on some ISP networks and not submitting on the others... Please why is it so? should I change anything??
I think there is a problem with the URL where it is submitting, if true, please guide me how should i solve
<?php
if (isPostRequest()) {
sleep(0);
// $a_f_name= ( ( $_POST['ad_name'] ) );
$title_ = ($_POST['c_title_']);
$country_ = htmlspecialchars ( stripslashes (trim( ($_POST['c_country_']))));
$name_1 = htmlspecialchars ( stripslashes (trim( ($_POST['c_name_']))));
$name_ = ucfirst($name_1);
$from = htmlspecialchars ( stripslashes (trim( ($_POST['c_email_']))));
$city_ = htmlspecialchars ( stripslashes (trim( ($_POST['c_city_']))));
$number_ = htmlspecialchars ( stripslashes (trim( ($_POST['c_phone_']))));
$address_ = htmlspecialchars ( stripslashes (trim( ($_POST['c_address_']))));
$company_ = htmlspecialchars ( stripslashes (trim( ($_POST['c_company_']))));
$zip_ = htmlspecialchars ( stripslashes (trim( ($_POST['c_zip_']))));
$msg_ = htmlspecialchars ( stripslashes (trim( ($_POST['c_message_']))));
$ip = getIp();
$original_ctry = getfromipdata_country();
$original_timezone = getfromipdata_timezone();
$original_lon = getfromipdata_lon();
$original_lat = getfromipdata_lat();
$insertdata = $app->db->insert('members', [
'title' => $title_,
'name' => $name_,
'email' => $from,
'phone_number' => $number_,
'company_name' => $company_,
'subject' => '-',
'message' => $msg_,
'city' => $city_,
'country' => $country_,
'fax' => '-',
'zip' => $zip_,
'ip_address' => $ip,
'c_address' => $address_,
'real_country' => $original_ctry,
'real_timezone' => $original_timezone,
'real_lon' => $original_lon,
'real_lat' => $original_lat,
// 'title' => '$title_',
// 'name' => '$name_',
// 'email' => '$from',
// 'phone_number' => '$number_',
// 'company_name' => '$company_',
// 'subject' => '-',
// 'message' => '$msg_',
// 'city' => '$city_',
// 'country' => 'a',
// 'fax' => 'a',
// 'zip' => 'a',
// 'ip_address' => 'a',
// 'c_address' => 'a',
]);
// $first_name = $name_;
// $contact = $number_;
// $subject = "Online Inquiry: " . $title_ . " " . $name_ . " emailed you with the following credentials:";
// $subject2 = "Copy of the inquiry sent to Starline Enterprises (Pvt) Ltd";
// $message = $name_ . " , having the credentials as: \n\n
// Name : " . $title_ . " " . $name_ . "\n
// Country: " . $country_ . "\n
// City: " . $city_ . "\n
// Phone Number: " . $number_ . "\n
// Company: " . $company_ . "\n
// Email: " . $from . "\n
// Message: " . $msg_ . "\n";
// $message2 = "Dear " . $title_ . " " . $name_ . ", here is a copy of your message to Starline Enterprises (Pvt) Ltd: \n" . $msg_;
// $headers = 'From: Paksalt <' . CONTACT_EMAIL . '>';
// $headers2 = 'From: Paksalt <' . CONTACT_EMAIL . '>';
// mail ( string $to , string $subject , string $message , array|string $additional_headers = [] , string $additional_params = "" ) : bool
// mail(CONTACT_EMAIL, $subject, $message, $headers);
// mail($from, $subject2, $message2, $headers);
die('Thankyou for contacting us, we will respond you shortly.');
}
$app->tpl->assign('pageContent', $app->db->get('site_contents', '*', [
'page_name' => 'contact'
])['page_content']);
And here is the .tpl file
{include file="header.tpl"}
{include file="breadcrumb.tpl"}
<div class="container container_form" style="">
<div class="row justify-content-center d-flex">
<div class="col-12">
<h1 class="main-heading text-center mt-3 d-block" style=""><span class="main-heading-color">Contact Us</span>
</h1>
<div class="justify-content-center d-flex">
<img src="{SITE_URL}/assets/css/image/icon-title.png" class="heading-title-icon d-block">
</div>
</div>
<div class="content-text col-12">
{$pageContent}
</div>
</div>
<form id="contactform_main">
<div class="row" style="">
<div class="col-12 col-md-6">
<div class="container-fluid w-100">
<div class="row">
<div class="col-2 p-0 w-100">
<select id="c_title_" name="c_title_" class="w-75 h-75 p-0 float-right">
<option value="">Title:</option>
<option value="Mr.">Mr.</option>
<option value="Mrs.">Mrs.</option>
<option value="Ms.">Ms.</option>
</select>
</div>
<div class="col-10 p-1">
<input class="form-control" type="text" id="c_name_" name="c_name_"
placeholder="Full Name..." required/>
<div class="error_div">
<span id="error_name" class="error_span"></span>
</div>
</div>
<div class="col-12 p-1">
<input class="form-control" type="email" id="c_email_" name="c_email_"
placeholder="Email..." required/>
<div class="error_div">
<span id="error_email" class="error_span"></span>
</div>
</div>
<div class="col-12 p-1">
<input class="form-control" type="text" id="c_phone_" name="c_phone_"
placeholder="Phone Number..." required/>
<div class="error_div">
<span id="error_phone" class="error_span"></span>
</div>
</div>
<div class="col-12 p-1">
<input class="form-control" type="text" id="c_company_" name="c_company_"
placeholder="Company Name..."/>
<div class="error_div">
<span id="error_company" class="error_span"></span>
</div>
</div>
</div>
</div>
</div>
<div class="col-12 col-md-6">
<div class="container-fluid w-100">
<div class="row">
<div class="col-12 p-1">
<!--<input class="form-control" type="text" name="c_country_" placeholder="Country..." required/>-->
{include file="countrylist.tpl"}
<div class="error_div">
<span id="error_country" class="error_span"></span>
</div>
</div>
<div class="col-12 p-1">
<input class="form-control" type="text" id="c_city_" name="c_city_" placeholder="City..."/>
<div class="error_div">
<span id="error_city" class="error_span"></span>
</div>
</div>
<div class="col-12 p-1">
<input class="form-control" type="text" id="c_zip_" name="c_zip_"
placeholder="Zip Code..."/>
<div class="error_div">
<span id="error_zip" class="error_span"></span>
</div>
</div>
<div class="col-12 p-1">
<textarea rows="2" class="form-control" id="c_address_" name="c_address_"
placeholder="Business Address..."/></textarea>
<div class="error_div">
<span id="error_address" class="error_span"></span>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="col-12 p-1">
<textarea rows="4" class="form-control" id="c_message_" name="c_message_"
placeholder="Write Your Message..." required/></textarea>
<div class="error_div">
<span id="error_message" class="error_span"></span>
</div>
</div>
<div class="row">
<div class="col-12 col-md-6 p-1" style="">
<div class="d-block p-0">
<div class="d-flex justify-content-center captia_div_">
<div class="captcha-text w-50 text-center">Are you human?</div>
<div class="w-25">
{$var1=rand(1,9)}
{$var2=rand(1,9)}
<p class="captcha-text text-center">{$var1} + {$var2} =</p>
<input type="hidden" name="c_captia_value" id="c_captia_value" value="{$var1 + $var2}" placeholder="{$var1} + {$var2} = ?">
</div>
<div class="w-25">
<input type="text" class="captcha-text form-control w-75" id="c_captia_confirm"
name="c_captia_confirm">
</div>
</div>
</div>
<div class="error_div text-center">
<span id="error_captia" class="error_span"></span>
</div>
</div>
<div class="col-12 col-md-6">
<input class="btn submit_btn" style="float: right;" type="button" name="_c_submit" value="Send Message" onClick="submit_data()">
<span id="error_title" class="error_span"></span>
</div>
<div class="col-12 justify-content-center d-flex text-center">
<div id="msgSuccess">
</div>
</div>
</div>
</div>
</form>
<script>
function submit_data() {
var title = jQuery('#c_title_').val();
var name = jQuery('#c_name_').val();
var email = jQuery('#c_email_').val();
var phone = jQuery('#c_phone_').val();
var company = jQuery('#c_company_').val();
var country = jQuery('#c_country_').val();
var city = jQuery('#c_city_').val();
var zip = jQuery('#c_zip_').val();
var address = jQuery('#c_address_').val();
var message = jQuery('#c_message_').val();
var captia_val = jQuery('#c_captia_value').val();
var captia_cnf = jQuery('#c_captia_confirm').val();
jQuery('.error_span').html('');
var is_error = '';
if (title == '') {
jQuery('#error_title').html('Please select your marital status before your name.');
is_error = 'yes';
}
if (name == '') {
jQuery('#error_name').html('Please write your full name precisely.');
is_error = 'yes';
}
if (email == '') {
jQuery('#error_email').html('Please write your operational email precisely.');
is_error = 'yes';
}
if (phone == '') {
jQuery('#error_phone').html('Please write your business phone number precisely.');
is_error = 'yes';
}
if (company == '') {
jQuery('#error_company').html('Please write your company name (if any) precisely.');
is_error = 'yes';
}
if (country == '') {
jQuery('#error_country').html('Please select your country where you are located.');
is_error = 'yes';
}
if (city == '') {
jQuery('#error_city').html('Please write your city where located.');
is_error = 'yes';
}
if (zip == '') {
jQuery('#error_zip').html('Please write your zip code of your location.');
is_error = 'yes';
}
if (address == '') {
jQuery('#error_address').html('Please write your business address precisely.');
is_error = 'yes';
}
if (message == '') {
jQuery('#error_message').html('Please write your message / inquiry precisely for us.');
is_error = 'yes';
}
if (captia_cnf == '') {
jQuery('#error_captia').html('Please fill in the captcha value.');
is_error = 'yes';
}
if (captia_cnf != captia_val) {
jQuery('#error_captia').html('Sorry, the captcha value is incorrect.');
is_error = 'yes';
}
if (is_error == '') {
var datastring = 'c_title_=' + title + '&c_name_=' + name + '&c_email_=' + email + '&c_phone_=' + phone + '&c_company_=' + company + '&c_country_=' + country + '&c_city_=' + city + '&c_zip_=' + zip + '&c_address_=' + address + '&c_message_=' + message + '&c_captia_confirm=' + captia_cnf;
jQuery('#msgSuccess').html('<img src="' + IMAGE_ASSETS_URL + 'loading-gif.gif" class="loading_gif">');
jQuery.ajax({
url: SITE_URL + '/contact',
type: 'post',
data: datastring,
success: function (data) {
jQuery('#msgSuccess').html(data);
}
});
$( '#contactform_main' ).each(function(){
this.reset();
});
}
}
</script>
{include file="footer.tpl"}
Form is not submitting on some networks, i.e some computers can submit the firm and some computers can not..... IDK why?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire