coding[1]
coding[1]
Php programs:
Counselling_form.php
<?php
// Database Connection
$servername = "localhost";
$username = "root";
$password = "";
$database = "counselling_db";
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%),
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;
.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>
</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>
<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>
</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>
</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>
<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";
'".($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: