Multiple submit buttons
Change class name on click in jQuery
HTML
<<?php
$page_title = 'Add Job';
require_once('includes/load.php');
// Checkin What level user has permission to view this page
page_require_level(3);
$conselected = 'contractor';
$all_contractors = find_all_contractors2('contractor');
$all_contractors_contact = find_all_contractors_contact('contractor_contact',$conselected);
$all_driller = find_all_driller('users');
$all_toppie = find_all_toppie('users');
$all_jobstatus = find_all_contractors('job_status');
$all_heads = find_all_heads('equip_products');
$all_cutters = find_all_cutters('equip_products');
?>
<script>
function goBack() {
window.history.back();
}
</script>
<?php
if(isset($_POST['add_job'])){
$req_fields = array('location','contractor','length', 'groundc' );
validate_fields($req_fields);
if(empty($errors)){
$j_location = remove_junk($db->escape($_POST['location'])); //checked
$j_startdate = remove_junk($db->escape($_POST['startdate'])); //checked
$n_startdate = date('Y-m-d', strtotime($j_startdate));
$j_address = remove_junk($db->escape($_POST['address'])); //checked
$j_contractor = remove_junk($db->escape($_POST['contractor'])); //checked
$j_contractor_contact = remove_junk($db->escape($_POST['contact'])); //checked
$j_length = remove_junk($db->escape($_POST['length'])); //checked
$j_groundc = remove_junk($db->escape($_POST['groundc'])); //checked
$j_jobstatus = remove_junk($db->escape($_POST['jobstatus'])); //checked
$j_driller = remove_junk($db->escape($_POST['driller'])); //checked
$j_boresize = remove_junk($db->escape($_POST['boresize']));
$j_pipesize = remove_junk($db->escape($_POST['pipesize']));
$j_belowinvert = remove_junk($db->escape($_POST['belowinvert']));
$j_grade = remove_junk($db->escape($_POST['grade']));
$j_centers = remove_junk($db->escape($_POST['centers']));
$j_centraliser = remove_junk($db->escape($_POST['centraliser']));
$j_notes =...
CSS
body {
background: #20262E;
padding: 20px;
font-family: Helvetica;
}
#banner-message {
background: #fff;
border-radius: 4px;
padding: 20px;
font-size: 25px;
text-align: center;
transition: all 0.2s;
margin: 0 auto;
width: 300px;
}
button {
background: #0084ff;
border: none;
border-radius: 5px;
padding: 8px 14px;
font-size: 15px;
color: #fff;
}
#banner-message.alt {
background: #0084ff;
color: #fff;
margin-top: 40px;
width: 200px;
}
#banner-message.alt button {
background: #fff;
color: #000;
}
JavaScript
//Add new contractor
$("#contractor").change(function () {
if ($(this).val() === 'addnewcon') {
$('#addnewconmodal').modal({show: true});
} else if ($(this).val() !== 'addnewcon') {
$('#addnewconmodal').modal({show: false});
}
});
//Add new contractor contact
$("#contact").change(function () {
if ($(this).val() === 'addnewcontact') {
$('#addnewcontactmodal').modal({show: true});
} else if ($(this).val() !== 'addnewcontact') {
$('#addnewcontactmodal').modal({show: false});
}
});
//Ajax call to get selected contractor
$("#contractor").on('change',function() {
var conselected = $(this).val();
if(conselected != "") {
$.ajax({
url:"ajax.php",
data:{consel_id:conselected},
type:'POST',
success:function(response) {
console.log(response);
var resp = $.trim(response);
$("#contact").html(resp);
console.log(resp);
$("#contact").selectpicker('refresh');
}
});
} else {
$("#contact").html("<option value=''>------- Select --------</option>");
}
});
//Ajax add new contractor
$(".cont_add").click(function() {
$(".selectpicker").selectpicker('refresh');
});
});