MMCT TEAM
Server IP : 103.53.40.154  /  Your IP : 18.222.92.56
Web Server : Apache
System : Linux md-in-35.webhostbox.net 4.19.286-203.ELK.el7.x86_64 #1 SMP Wed Jun 14 04:33:55 CDT 2023 x86_64
User : ppcad7no ( 715)
PHP Version : 8.2.25
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON
Directory (0750) :  /home2/ppcad7no/kanoonisamadhan.in/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home2/ppcad7no/kanoonisamadhan.in/donate.php
<?php
 include "admin/config.php";
if ($_SERVER["REQUEST_METHOD"] === "POST") {
    if (isset($_POST['submit'])) {
        $name = $_POST['name'];
        $phone = $_POST['phone'];
        $email = $_POST['email'];
        $address = $_POST['address'];
        $amount = $_POST['amount'];
        $type = $_POST['type'];

        if (empty($name)) {
            $errors[] = "Name field is required.";
        } elseif (!ctype_alpha($name)) {
            $errors[] = "Name can only contain alphabets.";
        }

        if (empty($email)) {
            $errors[] = "Email field is required.";
        }

        if (empty($phone)) {
            $errors[] = "Phone field is required.";
        } elseif (!preg_match('/^\d{10}$/', $phone)) {
            $errors[] = "Phone number should have exactly 10 digits.";
        }
        if (!empty($address)) {
            $address = htmlspecialchars($address);
        }

        if (empty($errors)) {
    $name =htmlspecialchars($_POST['name'],ENT_QUOTES);
    $email =htmlspecialchars($_POST['email'],ENT_QUOTES);
    $phone =htmlspecialchars($_POST['phone'],ENT_QUOTES);
    $address =htmlspecialchars($_POST['address'],ENT_QUOTES);
    $amount =htmlspecialchars($_POST['amount'],ENT_QUOTES);
    $type =htmlspecialchars($_POST['type'],ENT_QUOTES);
    
    $sql3="INSERT INTO `tbl_donation`(`name`, `phone`, `email`, `address`, `type`, `amount`) VALUES ('$name','$phone','$email','$address', '$type','$amount')";
    $result3 = mysqli_query($db, $sql3) or die("Query unsuccessful");
    
    if($result3){
            echo ("<script>
            window.alert('Succesfully Submitted Pay Now');
            window.location.href='scan.php';
            </script>");
		
		mysqli_close($db);
     }else{
        echo"Error ";
    }
    
 }
    }
}

?>

<!DOCTYPE html>
<html lang="zxx">


<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <!-- Title -->
    <title>Donate </title>
    <?php include 'top-link.php';?>
</head>

<body>
<?php include 'header.php';?>
<!-- Banner Area -->
<section id="common_banner_area">
        <div class="container">
            <div class="row">
                <div class="col-lg-12">
                    <div class="commn_banner_page">
                        <h2><span class="color_big_heading">Donate</span></h2>
                        <ul class="breadcrumb_wrapper">
                            <li class="breadcrumb_item"><a href="index.php">Home</a></li>
                            <li class="breadcrumb_item"><img src="assets/img/icon/arrow.png" alt="img"></li>
                            <li class="breadcrumb_item active">Donate</li>
                        </ul>
                    </div>
                </div>
            </div>
        </div>
    </section>

<section class="donat-page my-3 p-4">
    <div class="container">
        <div class="row">
            <div class="col-md-8">
                <div class="box1">
                    <img class="img-fluid" style="width:100%" src="https://m.economictimes.com/thumb/msid-63293846,width-1200,height-900,resizemode-4,imgsize-49958/donation-charity.jpg" alt="" >
                </div>
            </div>
            <div class="col-md-4 p-2">
                 <div style="box-shadow: rgba(99, 99, 99, 0.2) 0px 2px 8px 0px;padding: 16px;" class="box2">
                    <form action="<?php $_PHP_SELF ?>" method="POST">
                        <label for="fname">Name:</label><br>
                        <input style="width: 100%;padding: 10px;margin-bottom: 8px;" type="text" name="name" placeholder="Enter Your Name" ><br>
                        <?php if (isset($errors) && in_array("Name field is required.", $errors)) { ?>
                            <p class="error">Name field is required.</p>
                        <?php } elseif (isset($errors) && in_array("Name can only contain alphabets.", $errors)) { ?>
                            <p class="error">Name can only contain alphabets.</p>
                        <?php } ?>
                        <label for="amonut">Amount:</label><br>
                        <input style="width: 100%;padding: 10px;margin-bottom: 8px;" type="number" name="amount" placeholder="Enter Amount" ><br>
                        <label for="phone">Phone Number:</label><br>
                        <input style="width: 100%;padding: 10px;margin-bottom: 8px;" type="text" name="phone" placeholder="Enter Contact Number" minlength="10" maxlength="10" onkeypress="return isNumberKey(event)" pattern=".{10,10}" onpaste="return false;" required><br>
                        <?php if (isset($errors) && in_array("Phone field is required.", $errors)) { ?>
                            <p class="error">Phone field is required.</p>
                        <?php } elseif (isset($errors) && in_array("Phone number should have exactly 10 digits.", $errors)) { ?>
                            <p class="error">Phone number should have exactly 10 digits.</p>
                        <?php } ?>
                        <label for="lname">Email:</label><br>
                        <input style="width: 100%;padding: 10px;margin-bottom: 8px;" type="email" name="email" placeholder="Enter Your Email" ><br>
                        <?php if (isset($errors) && in_array("Email field is required.", $errors)) { ?>
                        <p class="error">Email field is required.</p>
                        <?php } ?>
                        <label for="lname">Address:</label><br>
                        <textarea style="width: 100%;padding: 10px;margin-bottom: 8px;" type="text" name="address" placeholder="Enter Your Address" ></textarea><br>
                        <label for="lname">Donation Type:</label><br>
                         <select style="width: 100%;padding: 10px;margin-bottom: 8px;" type="text" name="type">
                             <option>Choose donation type</option>
                             <option value="General Donation">General Donation</option>
                             <option value="Zakat">Zakat</option>
                             <option value="Sadaqah">Sadaqah</option>
                             <option value="Fitra">Fitra</option>
                             <option value="Khairat">Khairat</option>
                             <option value="Imdad">Imdad</option>
                         </select><br>
                        <br>
                        <button style="width: 100%;padding: 10px;margin-bottom: 8px;color: white;background:  #1fb0c1;" type="submit" name="submit">Donate Now</button>
                    </form> 
                 </div>
            </div>
        </div>
    </div>
</section>
    
<?php include 'footer.php';?>

MMCT - 2023