html - Ajax .Post - Sending own defined variable through to mail.php -


i getting info rest of variables last 1 want send in own predefined. reason aint going through mail.php

var it1 = "it service" ; //send ajax request $.post('mail.php',{name:$('#name').val(), companyname:$('#companyname').val(), designation:$('#designation').val(), onumber:$('#onumber').val(), mnumber:$('#mnumber').val(), email:$('#e-mail').val(), message:$('#message').val(), manage:$('#manage1').val(), tech:$('#tech1').val(), it:$it1}, 

mail.php looks like:

<?php // declare our variables $name = $_post['name']; $email = $_post['email']; $message = nl2br($_post['message']); $companyname = $_post['companyname']; $designation = $_post['designation']; $onumber = $_post['onumber']; $mnumber = $_post['mnumber']; $it = $_post['it']; $tech = $_post['tech']; $manage = $_post['manage'];  // set title message $subject = "message website"; $body = "name: $name\r\n,  e-mail: $email\r\n,  company name: $companyname\r\n,  designation: $designation\r\n,  office number: $onumber\r\n,  mobile: $mnumber\r\n, services: $it, $tech, $manage\r\n, message: \n\n$message\r\n"; 

you should follow format of other variables:

it:$('#it1').val() } 

or

it:$(it1).val() } 

Comments

Popular posts from this blog

how to proxy from https to http with lighttpd -

android - Automated my builds -

python - Flask migration error -