strawbs89

Untitled

Jan 11th, 2024
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.74 KB | Help | 0 0
  1. process.php
  2.  
  3. <?php
  4.  
  5.     if(isset($_POST['btn-send']))
  6.     {
  7.        $UserName = $_POST['UName'];
  8.        $Email = $_POST['Email'];
  9.        $Subject = $_POST['Subject'];
  10.        $Msg = $_POST['msg'];
  11.  
  12.        if(empty($UserName) || empty($Email) || empty($Subject) || empty($Msg))
  13.        {
  14.            header('location:index.php?error');
  15.        }
  16.        else
  17.        {
  18.            $to = "[email protected]";
  19.  
  20.            if(mail($to,$Subject,$Msg,$Email))
  21.            {
  22.                header("location:index.php?success");
  23.            }
  24.        }
  25.     }
  26.     else
  27.     {
  28.         header("location:index.php");
  29.     }
  30. ?>
  31.  
  32.  
  33. index.php
  34.  
  35. <!DOCTYPE html>
  36. <html lang="en">
  37. <head>
  38.     <meta charset="UTF-8">
  39.     <meta name="viewport" content="width=device-width, initial-scale=1.0">
  40.     <meta http-equiv="X-UA-Compatible" content="ie=edge">
  41.     <link rel="stylesheet" href="bootstrap.css">
  42.     <title>Request</title>
  43. </head>
  44. <body>
  45.  
  46.     <div class="container">
  47.         <div class="row">
  48.             <div class="col-lg-6 m-auto">
  49.                 <div class="card mt-5">
  50.                     <div class="card-title">
  51.                         <h2 class="text-center py-2"> Track Information </h2>
  52.                         <hr>
  53.                         <?php
  54.                             $Msg = "";
  55.                             if(isset($_GET['error']))
  56.                             {
  57.                                 $Msg = " Please Fill in the Blanks ";
  58.                                 echo '<div class="alert alert-danger">'.$Msg.'</div>';
  59.                             }
  60.  
  61.                             if(isset($_GET['success']))
  62.                             {
  63.                                 $Msg = " Request successful and should play shortly. ";
  64.                                 echo '<div class="alert alert-success">'.$Msg.'</div>';
  65.                             }
  66.                        
  67.                         ?>
  68.                     </div>
  69.                     <div class="card-body">
  70.                         <form action="process.php" method="post">
  71.                             <input type="text" name="UName" placeholder="Your Name" class="form-control mb-2">
  72.                             <input type="text" name="Email" placeholder="Track Name" class="form-control mb-2">
  73.                             <input type="text" name="Subject" placeholder="Artist Name" class="form-control mb-2">
  74.                             <textarea name="msg" class="form-control mb-2" placeholder="Dedication Message"></textarea>
  75.                             <button class="btn btn-success" name="btn-send"> Dedicate It! </button>
  76.                         </form>
  77.                     </div>
  78.                 </div>
  79.             </div>
  80.         </div>
  81.     </div>
  82. </body>
  83. </html>
Advertisement
Add Comment
Please, Sign In to add comment