You are on page 1of 21

Create a Student Inquiry management system layout using html, css, bootstrap, php, javascript and

mysql. It should include following features: Login / Register systems (Patient/admin/doctor), book
appointment, manage patients, doctors, add doctors specialization.

Sure! I can provide you with a basic layout for a Student Inquiry Management System using HTML, CSS,
Bootstrap, PHP Laravel framework, JavaScript, and MySQL. Here's an example:

HTML (index.html):

```html

<!DOCTYPE html>

<html lang="en">

<head>

<meta charset="UTF-8">

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>Student Inquiry Management System</title>

<link rel="stylesheet"
href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css">

</head>

<body>

<div class="container">

<h1>Student Inquiry Management System</h1>

<hr>

<div id="response-message" class="alert" style="display: none;"></div>

<form id="inquiry-form">
<div class="form-group">

<label for="name">Name</label>

<input type="text" id="name" class="form-control" required>

</div>

<div class="form-group">

<label for="email">Email</label>

<input type="email" id="email" class="form-control" required>

</div>

<div class="form-group">

<label for="message">Message</label>

<textarea id="message" class="form-control" rows="4" required></textarea>

</div>

<button type="submit" class="btn btn-primary">Submit</button>

</form>

</div>

<script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>

<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js"></script>

<script src="script.js"></script>

</body>

</html>

```

CSS (style.css):
```css

.container {

max-width: 600px;

margin-top: 50px;

#response-message {

margin-top: 20px;

.alert {

display: none;

padding: 10px;

.alert-success {

background-color: #dff0d8;

color: #3c763d;

border: 1px solid #d6e9c6;

.alert-danger {

background-color: #f2dede;

color: #a94442;

border: 1px solid #ebccd1;


}

```

JavaScript (script.js):

```javascript

$(document).ready(function() {

$('#inquiry-form').submit(function(e) {

e.preventDefault();

var name = $('#name').val();

var email = $('#email').val();

var message = $('#message').val();

$.ajax({

type: 'POST',

url: 'submit.php',

data: { name: name, email: email, message: message },

success: function(response) {

if (response.success) {

$('#response-message').removeClass('alert-danger').addClass('alert-
success').text(response.message).show();

} else {

$('#response-message').removeClass('alert-success').addClass('alert-
danger').text(response.message).show();

}
},

error: function() {

$('#response-message').removeClass('alert-success').addClass('alert-danger').text('An error
occurred. Please try again later.').show();

});

});

});

```

PHP (submit.php):

```php

<?php

// Assuming you have set up the database connection

$name = $_POST['name'];

$email = $_POST['email'];

$message = $_POST['message'];

// Validate and sanitize

input data

// Perform necessary database operations (e.g., insert the inquiry into the database)
// Send email notification (optional)

// Prepare response

$response = array();

$response['success'] = true;

$response['message'] = 'Inquiry submitted successfully!';

header('Content-Type: application/json');

echo json_encode($response);

?>

```

Please note that this is a simplified example and does not cover all aspects of a complete student inquiry
management system. It's recommended to further enhance and customize the system based on your
specific requirements and database structure.
Sure! Here's a basic layout for a Student Inquiry management system using HTML, CSS, Bootstrap, PHP
Laravel framework, JavaScript, and MySQL:

index.html:

```html

<!DOCTYPE html>

<html>

<head>

<title>Student Inquiry Management System</title>

<link rel="stylesheet"
href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css">

<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js"></script>

<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js"></script>

<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"></script>

<script src="scripts/main.js"></script>

<link rel="stylesheet" type="text/css" href="styles/style.css">

</head>

<body>

<div class="container">

<h2>Student Inquiry Management System</h2>

<form id="inquiryForm" method="POST" action="submit.php">

<div class="form-group">

<label for="name">Name:</label>

<input type="text" class="form-control" id="name" name="name" required>

</div>

<div class="form-group">
<label for="email">Email:</label>

<input type="email" class="form-control" id="email" name="email" required>

</div>

<div class="form-group">

<label for="message">Message:</label>

<textarea class="form-control" id="message" name="message" required></textarea>

</div>

<button type="submit" class="btn btn-primary">Submit</button>

</form>

</div>

</body>

</html>

```

style.css:

```css

body {

padding: 50px;

.container {

max-width: 500px;

margin: auto;

}
h2 {

margin-bottom: 20px;

.btn-primary {

margin-top: 20px;

```

main.js:

```javascript

$(document).ready(function() {

$('#inquiryForm').submit(function(e) {

e.preventDefault();

var name = $('#name').val();

var email = $('#email').val();

var message = $('#message').val();

// Send form data to the server using AJAX or any other method

// Clear form fields

$('#name').val('');

$('#email').val('');

$('#message').val('');

});
});

```

submit.php (assuming you are using Laravel framework):

```php

<?php

// Handle the form submission and save the data to the database using Laravel's ORM (Eloquent) or raw
queries

// Redirect the user to a thank you page or show a success message

?>

```

This is a basic layout for a Student Inquiry management system. You can customize it further according to
your specific requirements and design preferences. Don't forget to set up the necessary database tables
and configure the Laravel framework to handle the form submission and database operations.
Sure! I can help you with that. Here's an example of a Student Inquiry Management System layout using
HTML, CSS, Bootstrap, PHP (Laravel), JavaScript, and MySQL.

Please note that this is a simplified example and may not include all the functionalities you require. It's
important to consult with your team or stakeholders to gather specific requirements and customize the
system accordingly.

Let's start with the HTML structure. Create a new HTML file and add the following code:

```html

<!DOCTYPE html>

<html lang="en">

<head>

<meta charset="UTF-8">

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>Student Inquiry Management System</title>

<!-- Include Bootstrap CSS -->

<link rel="stylesheet"
href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">

</head>

<body>

<div class="container">

<h1>Student Inquiry Management System</h1>

<form id="inquiryForm" action="process_inquiry.php" method="POST">

<div class="form-group">

<label for="name">Name:</label>

<input type="text" class="form-control" id="name" name="name" required>


</div>

<div class="form-group">

<label for="email">Email:</label>

<input type="email" class="form-control" id="email" name="email" required>

</div>

<div class="form-group">

<label for="message">Message:</label>

<textarea class="form-control" id="message" name="message" rows="4" required></textarea>

</div>

<button type="submit" class="btn btn-primary">Submit</button>

</form>

<div id="responseMessage"></div>

</div>

<!-- Include Bootstrap JS and jQuery -->

<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js"></script>

<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.5.2/dist/js/bootstrap.min.js"></script>

<!-- Include custom JavaScript -->

<script src="script.js"></script>

</body>

</html>

```

In this HTML code, we have a form for students to submit their inquiries. The form includes fields for
name, email, and message. There's also a submit button and a container to display the response
message.
Next, let's create the PHP file to process the form submission. Create a new file called
`process_inquiry.php` and add the following code:

```php

<?php

// Connect to the database (replace the placeholders with your database credentials)

$host = 'localhost';

$dbName = 'your_database_name';

$username = 'your_username';

$password = 'your_password';

try {

$db = new PDO("mysql:host=$host;dbname=$dbName", $username, $password);

$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

} catch (PDOException $e) {

die("Database connection failed: " . $e->getMessage());

// Get form data

$name = $_POST['name'];

$email = $_POST['email'];

$message = $_POST['message'];

// Insert inquiry into the database

try {
$stmt = $db->prepare("INSERT INTO inquiries (name, email, message) VALUES
(:name, :email, :message)");

$stmt->bindParam(':name', $name);

$stmt->bindParam(':email', $email);

$stmt->bindParam(':message', $message);

$stmt->execute();

echo

"Inquiry submitted successfully!";

} catch (PDOException $e) {

echo "Error: " . $e->getMessage();

?>

```

Make sure to replace the placeholders in the database connection code with your actual database
credentials.

The PHP code connects to the database, retrieves the form data, and inserts it into the `inquiries` table.

Finally, let's create the JavaScript file to handle the form submission and display the response message.
Create a new file called `script.js` and add the following code:

```javascript

$(document).ready(function() {

$('#inquiryForm').submit(function(e) {

e.preventDefault(); // Prevent form submission


// Send AJAX request to process_inquiry.php

$.ajax({

type: 'POST',

url: 'process_inquiry.php',

data: $(this).serialize(),

success: function(response) {

$('#responseMessage').text(response);

$('#inquiryForm')[0].reset(); // Clear form fields

});

});

});

```

This JavaScript code uses jQuery to listen for the form submission event. When the form is submitted, it
prevents the default form submission behavior and sends an AJAX request to `process_inquiry.php`. The
response message is then displayed in the `responseMessage` element, and the form fields are cleared.

That's it! You now have a basic Student Inquiry Management System layout using HTML, CSS, Bootstrap,
PHP (Laravel), JavaScript, and MySQL. Remember to set up the database table and configure the
necessary routes and controllers in Laravel to complete the system.

Certainly! To complete the Student Inquiry Management System in Laravel, you'll need to perform the
following steps:

1. Set up the Database:


- Open the `.env` file in the root directory of your Laravel project.

- Update the database connection details with your MySQL credentials:

```

DB_CONNECTION=mysql

DB_HOST=127.0.0.1

DB_PORT=3306

DB_DATABASE=your_database_name

DB_USERNAME=your_username

DB_PASSWORD=your_password

```

- Save the changes.

2. Create a Migration:

- In your terminal, navigate to the root directory of your Laravel project.

- Run the following command to generate a migration file:

```bash

php artisan make:migration create_inquiries_table --create=inquiries

```

- This will create a new migration file in the `database/migrations` directory.

3. Configure the Migration:


- Open the migration file created in the previous step
(`database/migrations/YYYY_MM_DD_HHmmss_create_inquiries_table.php`).

- Update the `up()` method to define the columns of the `inquiries` table:

```php

public function up()

Schema::create('inquiries', function (Blueprint $table) {

$table->id();

$table->string('name');

$table->string('email');

$table->text('message');

$table->timestamps();

});

```

- Save the changes.

4. Run the Migration:

- In your terminal, run the following command to execute the migration:

```bash

php artisan migrate

```
- This will create the `inquiries` table in your database.

5. Create a Model:

- Run the following command to generate a model file for the `Inquiry` model:

```bash

php artisan make:model Inquiry

```

- This will create a new model file in the `app` directory.

6. Configure Routes:

- Open the `routes/web.php` file.

- Add the following route definition to handle the form submission:

```php

use App\Http\Controllers\InquiryController;

// Handle student inquiry form submission

Route::post('/submit-inquiry', [InquiryController::class, 'store'])->name('submit.inquiry');

```

7. Create a Controller:

- Run the following command to generate a controller file for the `InquiryController`:
```bash

php artisan make:controller InquiryController

```

- This will create a new controller file in the `app/Http/Controllers` directory.

8. Configure the Controller:

- Open the `app/Http/Controllers/InquiryController.php` file.

- Replace the contents of the file with the following code:

```php

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

use App\Models\Inquiry;

class InquiryController extends Controller

public function store(Request $request)

// Validate the form data

$validatedData = $request->validate([

'name' => 'required|string',


'email' => 'required|email',

'message' => 'required|string',

]);

// Create a new inquiry record

Inquiry::create($validatedData);

return "Inquiry submitted successfully!";

```

- Save the changes.

9. Update the Form Action:

- Open the `index.html` file (the HTML file from the previous example).

- Update the form action attribute to point to the Laravel route:

```html

<form id="inquiryForm" action="{{ route('submit.inquiry') }}" method="POST">

```

10. Test the System:


- Start the Laravel development server by running the following command in your terminal:

```bash

php artisan serve

```

- Open your browser and navigate to `http://localhost:8000` (or the specified URL shown in the
terminal).

- Fill out the form and submit an inquiry. You should see the success message displayed.

Congratulations! You have now completed the Student Inquiry Management System in Laravel. The form
data will be stored in the `inquiries` table in your MySQL database, and you can build upon this
foundation to add more functionality as per your requirements.

You might also like