query("SELECT MAX(id) AS max_id FROM centers"); $max_id_row = $max_id_query->fetch_assoc(); $new_id_no = $max_id_row['max_id'] + 1; if(isset($_POST['status']) && $_POST['status'] == 'insert') { $email_id = $_POST['email_id'] ?? ''; $contact_number = $_POST['contact_number'] ?? ''; // 1. Prepared Statement ke sath duplicate check $chk_stmt = $con->prepare("SELECT id FROM centers WHERE email_id = ? OR contact_number = ?"); $chk_stmt->bind_param("ss", $email_id, $contact_number); $chk_stmt->execute(); $chk_result = $chk_stmt->get_result(); if($chk_result->num_rows == 0) { // Image Upload Logic $image_name = ''; $img = photo_upload('image', 'centers'); if($img['status']){ $image_name = $img['file_name']; } if ($image_name != '') { $center_number = center_last_id(); // 2. Prepared Statement ke sath secure INSERT Query $insert_query = "INSERT INTO `centers` ( `id`, `timestamp`, `center_number`, `name`, `institute_name`, `dob`, `pan_number`, `aadhar_number`, `center_full_address`, `pincode`, `state_id`, `city_id`, `no_of_computer_operator`, `no_of_class_room`, `total_computer`, `space_of_computer_center`, `whatsapp_number`, `contact_number`, `email_id`, `qualification_of_center_head`, `staff_room`, `water_supply`, `toilet`, `reception`, `username`, `password`, `transection_id`, `status`, `image` ) VALUES ( NULL, CURRENT_TIMESTAMP, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, '', '0', ? )"; $ins_stmt = $con->prepare($insert_query); // Default Radio value handle karne ke liye $staff_room = $_POST['staff_room'] ?? 'no'; $water_supply = $_POST['water_supply'] ?? 'no'; $toilet = $_POST['toilet'] ?? 'no'; // Variable binding (25 inputs mapping 's') $ins_stmt->bind_param( "sssssssssssssssssssssssss", $center_number, $_POST['name'], $_POST['institute_name'], $_POST['dob'], $_POST['pan_number'], $_POST['aadhar_number'], $_POST['center_full_address'], $_POST['pincode'], $_POST['state_id'], $_POST['city_id'], // Now manual text value $_POST['no_of_computer_operator'], $_POST['no_of_class_room'], $_POST['total_computer'], $_POST['space_of_computer_center'], $_POST['whatsapp_number'], $contact_number, $email_id, $_POST['qualification_of_center_head'], $staff_room, $water_supply, $toilet, $_POST['reception'], $_POST['username'], $_POST['password'], $image_name ); if($ins_stmt->execute()){ echo ''; exit; } else { echo ''; } } else { echo ''; } } else { echo ''; } } ?>

Franchisee Registration Form

Please input all critical administrative and infrastructural specifications.