File "add_client.php"
Full Path: /home/leadltht/fastlinkinternet.com/administrator/data-provider/admin/add_client.php
File size: 1.73 KB
MIME-type: text/x-php
Charset: utf-8
<?php
// Database connection
$servername = "server329";
$username = "leadltht_prazey1982";
$password = "prazey1982123456";
$dbname = "leadltht_fastlinkinternet";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
if ($_SERVER["REQUEST_METHOD"] == "POST") {
// Get form data
$name = $_POST['name'];
$area = $_POST['area'];
$cutoff_day = $_POST['cutoff_day'];
// Insert client data into the database
$query = "INSERT INTO clients (name, area, cutoff_day) VALUES (?, ?, ?)";
$stmt = $conn->prepare($query);
$stmt->bind_param("ssi", $name, $area, $cutoff_day);
if ($stmt->execute()) {
$message = "Client added successfully.";
} else {
$message = "Error: " . $stmt->error;
}
$stmt->close();
$conn->close();
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Add Client</title>
</head>
<body>
<h2>Add New Client</h2>
<?php
if (isset($message)) {
echo "<p>$message</p>";
}
?>
<form action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]); ?>" method="post">
<label for="name">Client Name:</label>
<input type="text" id="name" name="name" required><br><br>
<label for="area">Area:</label>
<input type="text" id="area" name="area" required><br><br>
<label for="cutoff_day">Cutoff Day (1-31):</label>
<input type="number" id="cutoff_day" name="cutoff_day" min="1" max="31" required><br><br>
<input type="submit" value="Add Client">
</form>
</body>
</html>