Advertisement
Guest User

Untitled

a guest
Jul 28th, 2017
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.49 KB | None | 0 0
  1. <?php
  2. $db = new mysqli('host', 'username', 'password', 'database');
  3.  
  4. if($_SERVER['REQUEST_METHOD'] == "POST" && isset($_POST['title'], $_POST['details']))
  5. {
  6.     $title   = $db -> real_escape_string($_POST['title']);
  7.     $details = $db -> real_escape_string($_POST['details']);
  8.     $email   = '';
  9.    
  10.     if(isset($_POST['email']))
  11.     {
  12.         $email = $db -> real_escape_string($_POST['email']);
  13.     }
  14.    
  15.     $db -> query("INSERT INTO `submissions` (`submission_id`, `submission_title`, `submission_details`, `contact_email`, `time_submitted`, `status`) VALUES(0, '$title', '$details', '$email', UNIX_TIMESTAMP(), 0)") or die ('Failed to submit, please try again soon');
  16.     echo "Successfully Submitted";
  17. }
  18.  
  19. ?>
  20. <html>
  21.     <head>
  22.    
  23.     </head>
  24.     <body>
  25.         <center>
  26.             <form action="submit.php" method="POST">
  27.             <span style="font-size: 13px; font-family: lucida sans unicode;">
  28.                 <span style="font-size: 18px;">
  29.                     <b>Bug/Idea Submission Form</b>
  30.                 </span>
  31.                 <p>Title:</p>
  32.                 <input type="text" name="title" /><br />
  33.                 <p>Details:</p>
  34.                 <textarea name="details" rows="25" cols="50"></textarea><br /><br />
  35.                 <p>Contact Email <i>(Optional)</i>:</p>
  36.                 <input type="text" name="email" /><br />
  37.                 <input type="submit" value="Submit!" />
  38.             </span>
  39.             </form>
  40.         </center>
  41.     </body>
  42. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement