0% found this document useful (0 votes)
12 views25 pages

coding[1]

The document outlines a web-based student counseling system that includes a PHP form for collecting student information, contact details, living situation, emergency contacts, and health information. It features a multi-section form with integrated status tracking and escalation workflow for effective management of student counseling. The system is designed to enhance the counseling experience for students at Puducherry Technological University.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views25 pages

coding[1]

The document outlines a web-based student counseling system that includes a PHP form for collecting student information, contact details, living situation, emergency contacts, and health information. It features a multi-section form with integrated status tracking and escalation workflow for effective management of student counseling. The system is designed to enhance the counseling experience for students at Puducherry Technological University.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 25

A WEB BASED STUDENT

COUNSELLING SYSTEM WITH


INTEGRATED STATUS
TRACKING AND ESCALATION
WORKFLOW
(CODING AND IMPLEMENTATION)
CODING:

Php programs:

Counselling_form.php
<?php
// Database Connection
$servername = "localhost";
$username = "root";
$password = "";
$database = "counselling_db";

$conn = new mysqli($servername, $username, $password, $database);

if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
?>

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Student Counseling Form</title>
<style>

body {
font-family: Arial, sans-serif;
margin: 0;
padding: 20px;
background-color: #ffffff;
background: linear-gradient(135deg, #c70000 0%, #800000 100%);
background-image:
linear-gradient(135deg, rgb(117, 176, 239) 0%, rgba(199, 0, 0, 0.9) 100%),

animation: animateBackground 30s ease infinite;


}
body::before,
body::after {
content: "";
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
pointer-events: none;
}
body::before {
background-image: radial-gradient(circle, rgba(255, 255, 255, 0.1) 2px,
transparent 2px);
background-size: 50px 50px;
animation: floatingParticles 20s linear infinite;
}

body::after {
background-image: radial-gradient(circle, rgba(255, 255, 255, 0.05) 1px,
transparent 1px);
background-size: 30px 30px;
animation: floatingParticles 15s linear infinite reverse;
}

@keyframes floatingParticles {
0% {
background-position: 0 0;
}
100% {
background-position: 100px 100px;
}
}
.container {
width: 85%;
margin: 0 auto;
background-color: #ffffff;
padding: 20px;
border-radius: 8px;
box-shadow: 0 0 10px rgba(0,0,0,0.1);
}
/* .header {
background-color: #c40d0d;
color: #ffffff;
padding: 15px;
text-align: center;
border-radius: 5px;
margin-bottom: 20px;
} */
.section {
display: none;
}
.section.active {
display: block;
}
.section-title {
background-color: #c40d0d;
color: #ffffff;
padding: 8px;
margin: -15px -15px 15px -15px;
border-radius: 5px 5px 0 0;
}
.form-group {
margin-bottom: 15px;
}
label {
display: block;
margin-bottom: 5px;
color: #660000;
font-weight: bold;
}
input, select, textarea {
width: 100%;
padding: 8px;
border: 1px solid #660000;
border-radius: 4px;
box-sizing: border-box;
}
textarea {
height: 100px;
resize: vertical;
}
.button-container { /* Container for buttons */
text-align: center; /* Center the buttons */
margin-top: 20px;
}
button {
background-color: #c40d0d;
color: #ffffff;
padding: 10px 20px;
border: none;
border-radius: 4px;
cursor: pointer;
width: auto; /* Adjust width as needed */
font-size: 16px;
margin: 0 10px; /* Space between buttons */
}
button:hover {
background-color: #660000;
}
.page-indicator {
font-size: 16px;
text-align: center;
margin: 10px 0;
font-weight: bold;
color: #c40d0d;
}
.header {
background-color: #c40d0d;
color: #ffffff;
padding: 15px;
border-radius: 5px;
margin-bottom: 20px;

/* Use flex layout to position logo and text side by side */


display: flex;
align-items: center;
justify-content: center; /* centers horizontally in the container */
}
.header .logo {
width: 100px; /* Increase or decrease to make the logo bigger or smaller */
height: auto;
margin-right: 20px;
}
.header-text {
text-align: center;
}
.section-name {
margin-bottom: 20px;
padding: 20px;
background-color: #f8f8f8;
border-radius: 5px;
text-align: center;
color: #660000;
}
.checkbox-group {
display: flex;
flex-direction: column;
gap: 10px; /* Spacing between checkboxes */
}

.checkbox-group label {
display: flex;
align-items: center; /* Ensure vertical alignment */
font-size: 18px;
cursor: pointer;
gap: 20px; /* Space between checkbox and text */
}

.checkbox-group input[type="checkbox"] {
width: 20px; /* Set a specific width */
height: 20px; /* Set a specific height */
transform: scale(1.2); /* Slightly enlarge checkbox */
}

table {
width: 100%;
border-collapse: collapse;
margin-bottom: 20px; /* Space below the table */
}
th, td {
border: 1px solid #ddd; /* Add borders to cells */
padding: 50px; /* Add padding to cells */
text-align: left; /* Align text to the left */
}

th {
background-color: #f2f2f2; /* Light gray background for header */
font-weight: bold;
}

/* Style for radio buttons inside table cells */


td input[type="radio"] {
margin: 0 5px; /* Add some space around radio buttons */
transform: scale(1.2); /* Adjust size as needed */
}

/* Style for labels (optional) */


label {
font-size: 16px;
}

</style>
</head>
<body>
<div class="container">

<div class="header">
<!-- Larger logo -->
<img
src="https://www.dropbox.com/scl/fi/f8ilhoxl28jqijdm32td2/images1.jpg?
rlkey=xg25rffg8wen2jwgp4ms5wxln&raw=1"
alt="PTU Logo"
class="logo"
/>
<!-- Header text in a separate container -->
<div class="header-text">
<h2>Puducherry Technological University</h2>
<h3>Students Counseling form</h3>
</div>
</div>
<form action="submit_counselling_form.php" method="POST">
<div id="section1" class="section active">
<div class="section-name">
<h2>Section 1: General Information</h2>
</div>

<div class="form-group">
<label for="student_name">Name of the Student</label>
<input type="text" id="student_name" name="student_name">
</div>
<div class="form-group">
<label for="student_registration_number">Student Registration
Number</label>
<input type="text" id="student_registration_number"
name="student_registration_number">
</div> <div class="form-group">
<label for="department">Department</label>
<input type="text" id="department" name="department">
</div>

<div class="form-group">
<label for="dob">Date of Birth</label>
<input type="date" id="dob" name="dob">
</div>
<div class="form-group">
<label for="gender">Gender</label>
<select id="gender" name="gender">
<option value="male">Male</option>
<option value="female">Female</option>
<option value="other">Other</option>
</select>
</div>
<div class="form-group">
<label for="age">Age</label>
<input type="number" id="age" name="age">
</div>
<br>
<h3>Contact Information</h3>
<br>
<div class="form-group">
<label for="address">Address</label>
<textarea id="address" name="address"></textarea>
</div>
<div class="form-group">
<label for="mobile_number">Mobile Number</label>
<input type="text" id="mobile_number" name="mobile_number">
</div>
<div class="form-group">
<label for="student_email">Student Email ID</label>
<input type="email" id="student_email" name="student_email">
</div>
<br>
<h3>Living Situation</h3>
<br>
<div class="form-group">
<label for="living_situation">With whom do you live?</label>
<select id="living_situation" name="living_situation">
<option value="alone">Alone</option>
<option value="hostel">Hostel</option>
<option value="parent_or_guardian">Parent or Guardian</option>
</select>
</div>

<br><h3>Emergency Contacts</h3><br>
<div class="form-group">
<label for="emergency_contact1_name">Person 1: Name</label>
<input type="text" id="emergency_contact1_name"
name="emergency_contact1_name">
</div>
<div class="form-group">
<label for="emergency_contact1_number">Person 1: Contact
Number</label>
<input type="text" id="emergency_contact1_number"
name="emergency_contact1_number">
</div>
<div class="form-group">
<label for="emergency_contact1_relationship">Person 1:
Relationship</label>
<input type="text" id="emergency_contact1_relationship"
name="emergency_contact1_relationship">
</div>
<div class="form-group">
<label for="emergency_contact1_address">Person 1: Address</label>
<textarea id="emergency_contact1_address"
name="emergency_contact1_address"></textarea>
</div>

<div class="form-group">
<label for="emergency_contact2_name">Person 2: Name</label>
<input type="text" id="emergency_contact2_name"
name="emergency_contact2_name">
</div>
<div class="form-group">
<label for="emergency_contact2_number">Person 2: Contact
Number</label>
<input type="text" id="emergency_contact2_number"
name="emergency_contact2_number">
</div>
<div class="form-group">
<label for="emergency_contact2_relationship">Person 2:
Relationship</label>
<input type="text" id="emergency_contact2_relationship"
name="emergency_contact2_relationship">
</div>
<div class="form-group">
<label for="emergency_contact2_address">Person 2: Address</label>
<textarea id="emergency_contact2_address"
name="emergency_contact2_address"></textarea>
</div>

<br><h3>Health Information</h3><br>
<div class="form-group">
<label for="health_problems">Ongoing Health Problems</label>
<textarea id="health_problems" name="health_problems"></textarea>
</div>
<div class="form-group">
<label for="current_medications">Current Medications</label>
<textarea id="current_medications"
name="current_medications"></textarea>
</div>
<div class="form-group">
<label for="past_mental_health_diagnosis">Past Mental Health
Diagnosis</label>
<textarea id="past_mental_health_diagnosis"
name="past_mental_health_diagnosis"></textarea>
</div>
<div class="form-group">
<label for="understanding_past_diagnosis">Understanding of Past
Diagnosis (if applicable)</label>
<textarea id="understanding_past_diagnosis"
name="understanding_past_diagnosis"></textarea>
</div>
<div class="button-container">
<span class="page-indicator" id="pageIndicator">Page 1 of 6</span>
<button type="button" onclick="nextSection(2)"
id="nextButton">Next</button>
</div>
</div>

<div id="section2" class="section">


<div class="section-name">
<h2>Section 2: Description of the Present Issue</h2>
</div>

<br><h3>Symptom Checklist (Last Month)</h3><br>


<div class="form-group">
<div class="checkbox-group"> <label><input type="checkbox"
name="symptoms[]" value="abuse"> Abuse (physical, sexual, verbal)</label> <br>
<label><input type="checkbox" name="symptoms[]" value="alcohol">
Alcohol/Substance Abuse</label> <br>
<label><input type="checkbox" name="symptoms[]"
value="concentration"> Difficulty Concentrating</label> <br>
<label><input type="checkbox" name="symptoms[]" value="financial">
Financial Concerns</label> <br>
<label><input type="checkbox" name="symptoms[]" value="family">
Family emotional problems</label> <br>
<label><input type="checkbox" name="symptoms[]" value="health">
Health Problems</label> <br>
<label><input type="checkbox" name="symptoms[]"
value="loneliness"> Loneliness</label> <br>
<label><input type="checkbox" name="symptoms[]" value="stressed">
Stressed/under pressure</label> <br>
<label><input type="checkbox" name="symptoms[]" value="suicidal">
Suicidal Thoughts</label> <br>
</div>
</div>

<br><h3>Additional Information</h3><br>
<div class="form-group">
<label>What kind of support system do you have?</label>
<div class="checkbox-group">
<label><input type="checkbox" name="support_system[]"
value="family"> Family</label>
<label><input type="checkbox" name="support_system[]"
value="friends"> Friends</label>
</div>
</div>
<br>
<div class="form-group">
<label for="other_concerns">Any Other Concerns</label>
<textarea id="other_concerns" name="other_concerns"></textarea>
</div>

<div class="button-container">
<button type="button" onclick="previousSection(1)"
id="prevButton">Previous</button>
<span class="page-indicator" id="pageIndicator">Page 2 of 6</span>
<button type="button" onclick="nextSection(3)"
id="nextButton">Next</button>
</div>
</div>

<div id="section3" class="section">


<div class="section-name">
<h2>Section 3</h2>
</div>
<h3>How confident do you feel about your ability in the following
areas?</h3>
<table>
<thead>
<tr>
<th>Statement</th>
<th>Very Confident</th>
<th>Fairly Confident</th>
<th>Not at all Confident</th>
</tr>
</thead>
<tbody>
<tr>
<td>Discussing areas of development with others</td>
<td><input type="radio" name="goal_setting" value="most"></td>
<td><input type="radio" name="goal_setting"
value="sometimes"></td>
<td><input type="radio" name="goal_setting" value="rarely"></td>
</tr>
<tr>
<td>Discussing a situation accurately in writing </td>
<td><input type="radio" name="goal_planning" value="most"></td>
<td><input type="radio" name="goal_planning"
value="sometimes"></td>
<td><input type="radio" name="goal_planning" value="rarely"></td>
</tr>
<tr>
<td>Describing a situation orally</td>
<td><input type="radio" name="goal_progress" value="most"></td>
<td><input type="radio" name="goal_progress"
value="sometimes"></td>
<td><input type="radio" name="goal_progress" value="rarely"></td>
</tr>
<tr>
<td>Identifying existing knowledge of relvance to a particular
situation</td>
<td><input type="radio" name="parent_listen" value="most"></td>
<td><input type="radio" name="parent_listen"
value="sometimes"></td>
<td><input type="radio" name="parent_listen" value="rarely"></td>
</tr>
<tr>
<td>Devising an action plan to put that learning into practice</td>
<td><input type="radio" name="other_help" value="most"></td>
<td><input type="radio" name="other_help"
value="sometimes"></td>
<td><input type="radio" name="other_help" value="rarely"></td>
</tr>

</tbody>
</table>

<div class="button-container">
<button type="button" onclick="previousSection(2)"
id="prevButton">Previous</button>
<span class="page-indicator" id="pageIndicator">Page 3 of 6</span>
<button type="button" onclick="nextSection(4)"
id="nextButton">Next</button>
</div>
</div>

<div id="section4" class="section">


<div class="section-name">
<h2>Section 4: Self-Evaluation</h2>
</div>
<p>Rate the following six items as seldom , sometimes , or often</p>
<table>
<thead>
<tr>
<th>Statement</th>
<th>Seldom</th>
<th>Sometimes</th>
<th>Often</th>
</tr>
</thead>
<tbody>
<tr>
<td>I contribute ideas to the classroom discussion</td>
<td><input type="radio" name="gs" value="most"></td>
<td><input type="radio" name="gs" value="sometimes"></td>
<td><input type="radio" name="gs" value="rarely"></td>
</tr>
<tr>
<td>I encouraged others as we worked</td>
<td><input type="radio" name="gp" value="most"></td>
<td><input type="radio" name="gp" value="sometimes"></td>
<td><input type="radio" name="gp" value="rarely"></td>
</tr>
<tr>
<td>I helped to give direction to the work</td>
<td><input type="radio" name="gpr" value="most"></td>
<td><input type="radio" name="gpr" value="sometimes"></td>
<td><input type="radio" name="gpr" value="rarely"></td>
</tr>
<tr>
<td>I followed the direction of others</td>
<td><input type="radio" name="pl" value="most"></td>
<td><input type="radio" name="pl" value="sometimes"></td>
<td><input type="radio" name="pl" value="rarely"></td>
</tr>
<tr>
<td>I helped to make decisions and solve problems</td>
<td><input type="radio" name="help" value="most"></td>
<td><input type="radio" name="help" value="sometimes"></td>
<td><input type="radio" name="help" value="rarely"></td>
</tr>
<tr>
<td>I took risk by exploring things that were new to me</td>
<td><input type="radio" name="risk" value="most"></td>
<td><input type="radio" name="risk" value="sometimes"></td>
<td><input type="radio" name="risk" value="rarely"></td>
</tr>

</tbody>
</table>

<br>
<div class="form-group">
<label for="time_spent_on_academics">How much time do i spend on my
acedemics?</label>
<textarea id="time_spent_on_academics"
name="time_spent_on_academics"></textarea>
</div>
<div class="form-group">
<label for="most_interesting_today">What is the most intersting about what
i did today?</label>
<textarea id="most_interesting_today"
name="most_interesting_today"></textarea>
</div>
<div class="form-group">
<label for="decision_making_in_group">What decision i had to make while
we were working , in groups , and how I tried to solve the problems i faced?</label>
<textarea id="decision_making_in_group"
name="decision_making_in_group"></textarea>
</div>
<div class="form-group">
<label for="lessons_from_group_work">What have I learned from this
group working experience , and how can i apply what i have learned to other classes
and everyday life?</label>
<textarea id="lessons_from_group_work"
name="lessons_from_group_work"></textarea>
</div>

<div class="button-container">
<button type="button" onclick="previousSection(3)"
id="prevButton">Previous</button>
<span class="page-indicator" id="pageIndicator">Page 4 of 6</span>
<button type="button" onclick="nextSection(5)"
id="nextButton">Next</button>
</div>
</div>

<div id="section5" class="section">


<div class="section-name">

<h2>Section 5: Self-Determination</h2>
</div>
<h3>Self-Determination Skills help you to know yourself , your goals , and
the support you need to reach your goals.</h3>
<table>
<thead>
<tr>
<th>Statement</th>
<th>Most of the time</th>
<th>Sometimes</th>
<th>Rarely</th>
</tr>
</thead>
<tbody>
<tr>
<td>I set goals to get what i want or need</td>
<td><input type="radio" name="fivegs" value="most"></td>
<td><input type="radio" name="fivegs" value="sometimes"></td>
<td><input type="radio" name="fivegs" value="rarely"></td>
</tr>
<tr>
<td>I make plans for reaching my goals</td>
<td><input type="radio" name="fivegp" value="most"></td>
<td><input type="radio" name="fivegp" value="sometimes"></td>
<td><input type="radio" name="fivegp" value="rarely"></td>
</tr>
<tr>
<td>I check my progress on how I am progressing towards my
goals.</td>
<td><input type="radio" name="fivegpr" value="most"></td>
<td><input type="radio" name="fivegpr" value="sometimes"></td>
<td><input type="radio" name="fivegpr" value="rarely"></td>
</tr>
<tr>
<td>At home , my parents listen to me when I talk about what i want or
need .</td>
<td><input type="radio" name="fivepl" value="most"></td>
<td><input type="radio" name="fivepl" value="sometimes"></td>
<td><input type="radio" name="fivepl" value="rarely"></td>
</tr>
<tr>
<td>I have others in my life who help me to accomplish my
goals.</td>
<td><input type="radio" name="five1" value="most"></td>
<td><input type="radio" name="five1" value="sometimes"></td>
<td><input type="radio" name="five1" value="rarely"></td>
</tr>
<tr>
<td>I ask for help when I need it.</td>
<td><input type="radio" name="five2" value="most"></td>
<td><input type="radio" name="five2" value="sometimes"></td>
<td><input type="radio" name="five2" value="rarely"></td>
</tr>
<tr>
<td>I know what i need , what i like , and what I enjoy doing. </td>
<td><input type="radio" name="five3" value="most"></td>
<td><input type="radio" name="five3" value="sometimes"></td>
<td><input type="radio" name="five3" value="rarely"></td>
</tr>
<tr>
<td>I tell others what I need , what I like, and what I enjoy doing.</td>
<td><input type="radio" name="five4" value="most"></td>
<td><input type="radio" name="five4" value="sometimes"></td>
<td><input type="radio" name="five4" value="rarely"></td>
</tr>
<tr>
<td>I help to make choices about the support and accommodations that
I need at University.</td>
<td><input type="radio" name="five5" value="most"></td>
<td><input type="radio" name="five5" value="sometimes"></td>
<td><input type="radio" name="five5" value="rarely"></td>
</tr>
<tr>
<td>I can describe my learning difficulties to others.</td>
<td><input type="radio" name="five6" value="most"></td>
<td><input type="radio" name="five6" value="sometimes"></td>
<td><input type="radio" name="five6" value="rarely"></td>
</tr>
<tr>
<td>I believe I have control to direct my life.</td>
<td><input type="radio" name="five7" value="most"></td>
<td><input type="radio" name="five7" value="sometimes"></td>
<td><input type="radio" name="five7" value="rarely"></td>
</tr>
<tr>
<td>I take care of my personal needs (clothes , chores , meals ,
grooming).</td>
<td><input type="radio" name="five8" value="most"></td>
<td><input type="radio" name="five8" value="sometimes"></td>
<td><input type="radio" name="five8" value="rarely"></td>
</tr>
<tr>
<td>I make friends with others of my age.</td>
<td><input type="radio" name="five9" value="most"></td>
<td><input type="radio" name="five9" value="sometimes"></td>
<td><input type="radio" name="five9" value="rarely"></td>
</tr>
<tr>
<td>I make good choices.</td>
<td><input type="radio" name="five10" value="most"></td>
<td><input type="radio" name="five10" value="sometimes"></td>
<td><input type="radio" name="five10" value="rarely"></td>
</tr>
<tr>
<td>I beliee that working hard at university will help me to get a good
job.</td>
<td><input type="radio" name="five11" value="most"></td>
<td><input type="radio" name="five11" value="sometimes"></td>
<td><input type="radio" name="five11" value="rarely"></td>
</tr>
</tbody>
</table>
<br>
<div class="form-group">
<label for="first_goal">What is the first Goal that you have for
yourself?</label>
<textarea id="first_goal" name="first_goal"></textarea>
</div>
<div class="form-group">
<label for="steps_to_achieve_goal">List three things you can do to reach
this goal.</label>
<textarea id="steps_to_achieve_goal"
name="steps_to_achieve_goal"></textarea>
</div>
<div class="form-group">
<label for="how_others_can_help">How can people around you (teachers ,
family , friends , etc.) help you to build your self-determination skills?</label>
<textarea id="how_others_can_help"
name="how_others_can_help"></textarea>
</div>

<div class="button-container">
<button type="button" onclick="previousSection(4)"
id="prevButton">Previous</button>
<span class="page-indicator" id="pageIndicator">Page 5 of 6</span>
<button type="button" onclick="nextSection(6)"
id="nextButton">Next</button>
</div>

</div>
<div id="section6" class="section">
<div class="section-name">
<h2>Section 6: Extra-Curricular Activities</h2>
</div>
<h3>Interests</h3>
<div class="form-group">
<label for="interests">Hobbies and Interests</label>
<textarea id="interests" name="interests"></textarea>
</div>
<div class="form-group">
<label for="hobbies">What activities do you enjoy doing?</label>
<textarea id="hobbies" name="hobbies"></textarea>
</form>
</div>

<script>
let currentSection = 1;
const totalSections = 6;
const sections = document.querySelectorAll('.section'); // Get all sections
function previousSection() {
if (currentSection > 1) {
currentSection--;
showSection(currentSection);
updatePageIndicator();
window.scrollTo(0, 0); // Scroll to top
}
}

function updatePageIndicator() {
const pageIndicator = document.getElementById('pageIndicator');
pageIndicator.innerText = `Page ${currentSection} of ${totalSections}`;
}

// Initial setup
showSection(currentSection);
updatePageIndicator();
</script>

</body>
</html>

Submit_form.php:
<?php
include '../../User_login&auth/user_login/db_connect.php';

if ($_SERVER["REQUEST_METHOD"] == "POST") {
// Process checkboxes
$symptoms = isset($_POST['symptoms']) ? implode(", ", $_POST['symptoms']) :
"";
$support_system = isset($_POST['support_system']) ? implode(", ",
$_POST['support_system']) : "";
$status = "Pending";

// Insert directly with real_escape_string for each field


$sql = "INSERT INTO counselling_forms (
student_name, student_registration_number, department, dob, gender, age,
address,
mobile_number, student_email, living_situation, emergency_contact1_name,
emergency_contact1_number, emergency_contact1_relationship,
emergency_contact1_address,
emergency_contact2_name, emergency_contact2_number,
emergency_contact2_relationship,
emergency_contact2_address, health_problems, current_medications,
past_mental_health_diagnosis,
understanding_past_diagnosis, symptoms, support_system, other_concerns,
goal_setting,
goal_planning, goal_progress, parent_listen, other_help,
hobbies, physically_fit_sports, enjoyable_activities, status
) VALUES (
'".($conn->real_escape_string($_POST['student_name'] ?? ''))."',
'".($conn->real_escape_string($_POST['student_registration_number'] ?? ''))."',
'".($conn->real_escape_string($_POST['department'] ?? ''))."',
'".($conn->real_escape_string($_POST['dob'] ?? ''))."',
'".($conn->real_escape_string($_POST['gender'] ?? ''))."',
".intval($_POST['age'] ?? 0).",
'".($conn->real_escape_string($_POST['address'] ?? ''))."',
'".($conn->real_escape_string($_POST['mobile_number'] ?? ''))."',
'".($conn->real_escape_string($_POST['student_email'] ?? ''))."',
'".($conn->real_escape_string($_POST['living_situation'] ?? ''))."',
'".($conn->real_escape_string($_POST['emergency_contact1_name'] ?? ''))."',
'".($conn->real_escape_string($_POST['emergency_contact1_number'] ?? ''))."',
'".($conn->real_escape_string($_POST['emergency_contact1_relationship'] ??
''))."',
'".($conn->real_escape_string($_POST['emergency_contact1_address'] ?? ''))."',
'".($conn->real_escape_string($_POST['emergency_contact2_name'] ?? ''))."',
'".($conn->real_escape_string($_POST['emergency_contact2_number'] ?? ''))."',
'".($conn->real_escape_string($_POST['emergency_contact2_relationship'] ??
''))."',
'".($conn->real_escape_string($_POST['emergency_contact2_address'] ?? ''))."',
'".($conn->real_escape_string($_POST['health_problems'] ?? ''))."',
'".($conn->real_escape_string($_POST['current_medications'] ?? ''))."',
'".($conn->real_escape_string($_POST['past_mental_health_diagnosis'] ?? ''))."',
'".($conn->real_escape_string($_POST['understanding_past_diagnosis'] ?? ''))."',
'".($conn->real_escape_string($symptoms))."',

'".($conn->real_escape_string($_POST['risk'] ?? ''))."',
'".($conn->real_escape_string($_POST['time_spent_on_academics'] ?? ''))."',
'".($conn->real_escape_string($_POST['most_interesting_today'] ?? ''))."',
'".($conn->real_escape_string($_POST['decision_making_in_group'] ?? ''))."',
'".($conn->real_escape_string($_POST['lessons_from_group_work'] ?? ''))."',
'".($conn->real_escape_string($_POST['five11'] ?? ''))."',
'".($conn->real_escape_string($_POST['first_goal'] ?? ''))."',
'".($conn->real_escape_string($_POST['steps_to_achieve_goal'] ?? ''))."',
'".($conn->real_escape_string($_POST['how_others_can_help'] ?? ''))."',
'".($conn->real_escape_string($_POST['interests'] ?? ''))."',
'".($conn->real_escape_string($_POST['hobbies'] ?? ''))."',
'".($conn->real_escape_string($_POST['physically_fit_sports'] ?? ''))."',
'".($conn->real_escape_string($_POST['enjoyable_activities'] ?? ''))."',
'".($conn->real_escape_string($status))."'
)";

if ($conn->query($sql)) {
// Redirect to dashboard on success
header('Location: ../Dashboard_Access&Navigation/dashboard.php');
exit();
} else {
echo "Error: " . $conn->error;
}
}
// If the form wasn't submitted with POST method, redirect to the form page
else {
header('Location: counselling_form.php');
exit();
}
?>

Database Query:

CREATE TABLE users (


name VARCHAR(100),
role VARCHAR(50),
email VARCHAR(100) UNIQUE,
password VARCHAR(100)
);

CREATE TABLE dean (


id INT PRIMARY KEY,
name VARCHAR(100);
email VARCHAR(100) UNIQUE,
password VARCHAR(100)
);

CREATE TABLE hod (


id INT PRIMARY KEY,
name VARCHAR(100),
email VARCHAR(100) UNIQUE,
password VARCHAR(100),
department VARCHAR(100)
);
CREATE TABLE class_advisor (
id INT PRIMARY KEY,
name VARCHAR(100),
email VARCHAR(100) UNIQUE,
password VARCHAR(100),
department VARCHAR(100)
);

CREATE TABLE student (


reg_no VARCHAR(20) PRIMARY KEY,
name VARCHAR(100),
email VARCHAR(100) UNIQUE,
password VARCHAR(100)
);

CREATE TABLE counselling_form (


id INT PRIMARY KEY AUTO_INCREMENT,
student_name VARCHAR(100),
dob DATE,
age INT,
gender VARCHAR(10),
address TEXT,
mobile_number VARCHAR(15),
living_situation VARCHAR(100),
student_email VARCHAR(100),
emergency_contact1_name VARCHAR(100),
emergency_contact1_no VARCHAR(15),
emergency_contact2_name VARCHAR(100),
emergency_contact2_no VARCHAR(15),
understanding_past_diagnosis TEXT,
past_mental_health_diagnosis TEXT,
current_medication TEXT,
health_problems TEXT
);

You might also like