php - $_POST not inserting values in the database -
i have form. when user submits, values should insert in database. value of 1 $_post not inserted in database, other $_post's inserting properly.
how fix this?
html:
<input type="text" name="position" value="<?php echo $_post['jobtitle']; ?>" id="position" required/>
php snippet:
$firstname = $middlename = $lastname = $email = $mobile = $resume = $position = $message = $attachment_id = $locations = ""; if(isset($_post['submit'])){ $firstname = isset($_post['firstname']) ? $_post['firstname'] : ''; $middlename = isset($_post['middlename']) ? $_post['middlename'] : ''; $lastname = isset($_post['lastname']) ? $_post['lastname'] : ''; $email = isset($_post['email']) ? $_post['email'] : ''; $mobile = isset($_post['mobile']) ? $_post['mobile'] : ''; $locations = isset($_post['locations_list']) ? $_post['locations_list'] : ''; $position = isset($_post['jobtitle']) ? $_post['jobtitle'] : ''; $message = isset($_post['message']) ? $_post['message'] : ''; if( ! empty($_files)){ $file=$_files['resumefile']; $attachment_id = upload_user_file($file); } $sql=$wpdb->query("insert resume_databank(submit_time,last_name,first_name,middle_name,mobile_number,email,location,position,message,process_resume,attachment_resume_id) values (now(),'$lastname','$firstname','$middlename','$mobile','$email','$locations','$position','$message','no','$attachment_id')"); } exit();
change part
$position = isset($_post['jobtitle']) ? $_post['jobtitle'] : '';
to
$position = isset($_post['position']) ? $_post['position'] : '';
because in form. field name position
, $_post['jobtitle'];
value
Comments
Post a Comment