Advertisement
Guest User

Untitled

a guest
Feb 18th, 2017
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 4.03 KB | None | 0 0
  1. <?php
  2. session_start();
  3. ?>
  4. <!DOCTYPE html>
  5. <html lang="en">
  6.     <head>
  7.         <meta charset="utf-8">
  8.         <meta name="viewport" content="width=device-width, initial-scale=1.0">
  9.         <title>Panel</title>
  10.  
  11.         <!-- Bootstrap core CSS -->
  12.         <link href="http://orders.code3.x10host.com/css/bootstrap.css" rel="stylesheet" type="text/css">
  13.  
  14.         <!-- jQuery and table sorter -->
  15.         <script type="text/javascript" src="../assets/js/jquery-3.1.0.min.js"></script>
  16.         <script type="text/javascript" src="../assets/js/stupidtable.js"></script>
  17.  
  18.         <script type="text/javascript">
  19.         $(document).ready(function()
  20.             {
  21.                 $("#mainPanel").stupidtable();
  22.             }
  23.         );
  24.         </script>
  25.     </head>
  26. <body class="login-body" style="background: none;">
  27.     <div class="container">
  28.         <div class="panel panel-default">
  29.         <?php
  30.         include_once("../functions/functions.php");
  31.         ?>
  32.     <div class="panel-body">
  33. <form action="" method="post">  
  34.     <table class="table" style="width: 25%;">
  35.        <tr>
  36.           <td align="center">Name:</td>
  37.           <td align="center"><input type="text" name="name"></td>
  38.        </tr>
  39.        <tr>
  40.           <td align="center">Notes:</td>
  41.           <td align="center"><input type="text" name="notes"></td>
  42.        </tr>
  43.     </table>
  44.        <table class="table" style="width: 25%;">
  45.        <tr>
  46.           <td colspan="11" align="center">Vehicles</td>
  47.        </tr>
  48.        <tr>  
  49.           <td align="center" style="width: 90%;"></td>  
  50.           <td align="center" style="width: 10%;">Amount</td>  
  51.        </tr>
  52.        <tr>  
  53.           <td align="center">CVPI</td>  
  54.           <td align="center"><select name="car[]">
  55.               <option value=""></option>
  56.           <option value="1 CVPI">1</option>
  57.           <option value="2 CVPIs">2</option>
  58.           <option value="3 CVPIs">3</option>
  59.           <option value="4 CVPIs">4</option>
  60.           <option value="5 CVPIs">5</option>
  61.           <option value="6 CVPIs">6</option>
  62.           <option value="7 CVPIs">7</option>
  63.           <option value="8 CVPIs">8</option>
  64.           <option value="9 CVPIs">9</option>
  65.           <option value="10 CVPIs">10</option>
  66.       </select></td>
  67.        </tr>
  68.        <tr>  
  69.           <td align="center">Slicktop CVPI</td>  
  70.           <td align="center"><select name="car[]">
  71.               <option value=""></option>
  72.           <option value="1 NL CVPI">1</option>
  73.           <option value="2 NL CVPIs">2</option>
  74.           <option value="3 NL CVPIs">3</option>
  75.           <option value="4 NL CVPIs">4</option>
  76.           <option value="5 NL CVPIs">5</option>
  77.           <option value="6 NL CVPIs">6</option>
  78.           <option value="7 NL CVPIs">7</option>
  79.           <option value="8 NL CVPIs">8</option>
  80.           <option value="9 NL CVPIs">9</option>
  81.           <option value="10 NL CVPIs">10</option>
  82.       </select></td>
  83.        </tr>
  84.        </table>
  85.        <table class="table" style="width: 25%;">
  86.        <tr>
  87.           <td colspan="11" align="center">Items</td>
  88.        </tr>
  89.     </table>
  90.        </tr>
  91.           <td colspan="2" align="center"><input type="submit" value="submit" name="sub"></td>  
  92.        </tr>  
  93.     </form>  
  94.     <?php  
  95.    if(isset($_POST['sub']))  
  96.    {  
  97.     $servername = "localhost";
  98.     $username = "code3x10_forms";
  99.     $password = "formsforcode3";
  100.     $dbname = "code3x10_orders";
  101.    
  102.     $con = new mysqli($servername, $username, $password, $dbname);
  103.     if ($con->connect_error) {
  104.         die("Connection failed: " . $conn->connect_error);
  105.     }
  106.     foreach ($_POST['car'] as $select)
  107.     {
  108.     $chk .= $select.", ";  
  109.     }
  110.         $in_ch=mysqli_query($con,"INSERT INTO test (faction, name, items, filled, notes) VALUES (
  111.             'SD',
  112.             '".$_POST['name']."',
  113.             '$chk ',
  114.             'No',
  115.             '".$_POST['notes']."'
  116.             )");  
  117.         if($in_ch>=1)  
  118.            {  
  119.               echo '<div class="alert alert-success">Successfully submitted order, redirecting...</div><meta http-equiv="refresh" content="1;url=http://code3.x10host.com/">';
  120.            }  
  121.         else  
  122.            {  
  123.               echo '<div class="alert alert-warning">Failed to submit order, redirecting...</div><meta http-equiv="refresh" content="1;url=http://code3.x10host.com/">';
  124.            }  
  125.         }  
  126.     $con->close();
  127.     ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement