📁 File Manager
🏠 /
/
home
/
u857492117
/
domains
/
mangaldaicollege.org
/
public_html
/
admission
Dosya Düzenle: submit_admission.php
<?php error_reporting(E_ALL); ini_set('display_errors', 1); session_start(); include("connect.php"); // Check that this file exists and connects using $con if ($_SERVER["REQUEST_METHOD"] == "POST") { // Session values $name = $_SESSION['name'] ?? ''; $dob = $_SESSION['dob'] ?? ''; $guroll = $_SESSION['guroll'] ?? ''; $enroll = $_SESSION['enroll'] ?? ''; $abc = $_SESSION['abc'] ?? ''; $collegeroll = $_SESSION['collegeroll'] ?? ''; $phone = $_SESSION['phone'] ?? ''; $email = $_SESSION['email'] ?? ''; $admissionfor = $_SESSION['admissionfor'] ?? ''; // POST values $fathername = $_POST['fathername'] ?? ''; $mothername = $_POST['mothername'] ?? ''; $guardian = $_POST['guardian'] ?? ''; $gender = $_POST['gender'] ?? ''; $caste = $_POST['caste'] ?? ''; // $address = $_POST['address'] ?? ''; $stream = $_POST['stream'] ?? ''; $majorstatus = $_POST['majorstatus'] ?? ''; $sub1 = $_POST['sub1'] ?? ''; $sub2 = $_POST['sub2'] ?? ''; $sec = $_POST['sec'] ?? ''; $fees = $_POST['fees'] ?? ''; $feeAmount = $_POST['feeAmount'] ?? 0.00; $village = $_POST['village']; $po = $_POST['po']; $ps = $_POST['ps']; $dist = $_POST['dist']; $state = $_POST['state']; $pin = $_POST['pin']; // Combine all into one formatted address string $address = "Vill: $village, PO: $po, PS: $ps, Dist: $dist, State: $state, Pin: $pin"; // Check DB connection if (!$con) { die("Database connection failed: " . mysqli_connect_error()); } $con->begin_transaction(); try { // Insert personal_details $sql1 = "INSERT INTO personal_details (guroll, collegeroll, fathername, mothername, guardian, gender, caste, address) VALUES (?, ?, ?, ?, ?, ?, ?, ?)"; $stmt1 = $con->prepare($sql1); $stmt1->bind_param("ssssssss", $guroll, $collegeroll, $fathername, $mothername, $guardian, $gender, $caste, $address); if (!$stmt1->execute()) { throw new Exception("Error in personal_details: " . $stmt1->error); } // Insert academic_details $sql2 = "INSERT INTO academic_details (guroll, collegeroll, stream, majorstatus, sub1, sub2,sec) VALUES (?, ?, ?, ?, ?, ?, ?)"; $stmt2 = $con->prepare($sql2); $stmt2->bind_param("sssssss", $guroll, $collegeroll, $stream, $majorstatus, $sub1, $sub2, $sec); if (!$stmt2->execute()) { throw new Exception("Error in academic_details: " . $stmt2->error); } // Insert fees_details // Static values for feetype and remarks $feetype = 'admission2025'; $feeremarks = 'pending'; $challan_no = "ADM25" . $collegeroll; // Insert into fees_details table $sql3 = "INSERT INTO fee_details (guroll, collegeroll, fees, feeAmount, feetype, remarks, challan_no, transaction_id, payment_date, payment_status) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"; $stmt3 = $con->prepare($sql3); $stmt3->bind_param("ssssssssss", $guroll, $collegeroll, $fees, $feeAmount, $feetype, $feeremarks,$challan_no, $transaction_id, $payment_date, $payment_status); if (!$stmt3->execute()) { echo "<script>alert('Error inserting into fees_details: " . $stmt3->error . "'); history.back();</script>"; exit; } // Insert form_status $formno = "ADM25" . $collegeroll; $submissiondate = date("Y-m-d"); $status = "Submitted"; $remarks = "Pending Verification"; $sql4 = "INSERT INTO form_status (registrationformno, guroll, collegeroll, submission_date, status, remarks) VALUES (?, ?, ?, ?, ?, ?)"; $stmt4 = $con->prepare($sql4); $stmt4->bind_param("ssssss", $formno, $guroll, $collegeroll, $submissiondate, $status, $remarks); if (!$stmt4->execute()) { throw new Exception("Error in form_status: " . $stmt4->error); } $con->commit(); echo "<script>alert('Admission form submitted successfully.'); window.location='admission_apply_2025_self.php';</script>"; } catch (Exception $e) { $con->rollback(); echo "<strong>Submission Failed:</strong> " . $e->getMessage(); } // Close all $stmt1->close(); $stmt2->close(); $stmt3->close(); $stmt4->close(); $con->close(); } else { echo "<script>alert('Invalid request.'); window.location='admission_apply_2025_self.php';</script>"; } ?>
💾 Kaydet
İptal