I am having a problem sending the dataString to the server. Aparently it is not pulling the values correctly from the form. Below is my jquery and my php.
$(document).ready(function() {
$("#submitForm").live('click', function() {
updateUserInfo();
});
var birthdate = $("#birthdate");
var sex = $("#sex");
var interestedIn = $("#interestedIn");
var relationshipStatus = $("#relationshipStatus");
var knownLanguages = $("#knownLanguages");
var religiousViews = $("#religiousViews");
var politicalViews = $("#politicalViews");
var aboutMe = $("#aboutMe");
var mobilePhone = $("#mobilePhone");
var neighborhood = $("#neighborhood");
var website = $("#website");
var email = $("#email");
var dataString = birthdate + sex + interestedIn + relationshipStatus + knownLanguages + politicalViews + aboutMe + mobilePhone + neighborhood + website + email;
function updateUserInfo() {
jQuery.ajax({
type: "POST",
dataType: "JSON",
url: "<?=base_url()?>index.php/regUserDash/updateUserInfo",
data: dataString,
json: {userInfoUpdated: true},
success: function(data) {
if(data.userInfoUpdated == true) {
alert("hello");
}
}
});
}
});
My PHP:
public function updateUserInfo() {
$userid = $this->session->userdata('userid');
$birthdate = $this->input->post("birthdate");
$sex = $this->input->post("sex");
$interestedIn = $this->input->post("interestedIn");
$relationshipStatus = $this->input->post("relationshipStatus");
$languages = $this->input->post("languages");
$religiousViews = $this->input->post("religiousViews");
$politicalViews = $this->input->post("politicalViews");
$aboutMe = $this->input->post("aboutMe");
$mobilePhone = $this->input->post("mobilePhone");
$neighborhood = $this->input->post("neighborhood");
$websites = $this->input->post("websites");
$email = $this->input->post("email");
$this->db->query("INSERT IGNORE INTO user_info (birthdate, sex, interestedIn, relationshipStatus, Languages, religiousViews, politicalViews, aboutMe, mobilePhone, neighborhood, websites, email, userid)
VALUES('{$birthdate}', '{$sex}', {$relationshipStatus}', '{$languages}, {$religiousViews}', '{$politicalViews}', {$aboutMe}', '{$mobilePhone}' {$neighborhood}', '{$websites}', {$email}', '{$userid}')");
echo json_encode(array('userInfoUpdated' => true));
}