| Server IP : 68.178.172.28 / Your IP : 216.73.216.26 Web Server : Apache System : Linux 28.172.178.68.host.secureserver.net 4.18.0-553.89.1.el8_10.x86_64 #1 SMP Mon Dec 8 03:53:08 EST 2025 x86_64 User : kiskarnal ( 1003) PHP Version : 8.0.30 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /home/kiskarnal/www/scholarship/ |
Upload File : |
<?php
session_start();
# -- this is insert.php --
/**
* The follwing Condition checks whether a client requested the insert.php through
* the POST method with the u_name, u_age, and u_email
*
* u_name, u_age, and u_email - You can also see these in the HTML Form (index.html) -
* These are keys to access the actual data provided by a user.
*/
if (isset($_POST['name']) && isset($_POST['email']) && isset($_POST['phone'])&& isset($_POST['city'])) :
# Database Connection my_test_db is the Database name.
$db_conn = mysqli_connect("localhost", "u589835532_scholarip_user", "kisScholarship12345@", "u589835532_kis_scholrship");
# Assigning user data to variables for easy access later.
$name = $_POST['name'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$city = $_POST['city'];
$class = $_POST['class'];
# SQL query for Inserting the Form Data into the users table.
$sql = "INSERT INTO `leads` (`name`, `email`, `phone`, `city`, `class`) VALUES ('$name', '$email', '$phone','$city','$class')";
# Executing the Above SQL query.
$query = mysqli_query($db_conn, $sql);
# Checks that the query executed successfully
if ($query) {
header("Location: index.php?message=Data inserted successfully.");
} else {
header("Location: index.php?message=Failed to insert new data.");
}
exit;
endif;
/**
* This message occurs when a user tries to access Insert.php without -
* the required method and credentials.
*/
echo '404 Page Not Found. <a href="./index.php">Go Home</a>';