Advertisement
Guest User

Untitled

a guest
Apr 30th, 2018
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.26 KB | None | 0 0
  1.  
  2. <!DOCTYPE html>
  3. <html>
  4. <head>
  5. <title>TV STORE JUSTIN CHUDLEY</title>
  6. <?php
  7. $servername = "localhost";
  8. $username = "root";
  9. $password = "root";
  10. $conn = new mysqli($servername, $username, $password);
  11. if($conn ->connect_error){
  12. die("Could not connect: " . $conn->connect_error);
  13. }
  14. $conn->select_db("tv_store");
  15.  
  16. //CREATE DB IF db does not exist
  17. $sql = 'CREATE DATABASE IF NOT EXISTS tv_store';
  18.  
  19. if($conn->query($sql) == TRUE){
  20. //echo "Database created!\n";
  21. }
  22.  
  23. else{
  24. //echo 'Error: ' . $conn->error . "\n";
  25. }
  26.  
  27. //CREATE TABLE IF table does not exist
  28. $sql = "CREATE TABLE IF NOT EXISTS products
  29. (
  30. productNumber INT(6) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
  31. productName VARCHAR(30) NOT NULL,
  32. price VARCHAR(30) NOT NULL
  33. )";
  34.  
  35. if ($conn->query($sql) == TRUE){
  36. //echo "Table has been created!\n";
  37. }
  38. else{
  39. //echo "Error creating table!";
  40. }
  41.  
  42. //INSERT Data IF data is not already inserted
  43. $sql = "INSERT IGNORE INTO products
  44. (productNumber, productName,price)
  45. VALUES ('1', 'Plasma','$500')";
  46. if ($conn->query($sql) == TRUE){
  47. //echo "insert has been created!\n";
  48. }
  49. else{
  50. //echo "Error creating insert!";
  51. }
  52.  
  53. $sql = "INSERT IGNORE INTO products
  54. (productNumber, productName,price)
  55. VALUES ('2', 'Flatscreen','$750')";
  56. if ($conn->query($sql) == TRUE){
  57. //echo "insert has been created!\n";
  58. }
  59. else{
  60. //echo "Error creating insert!";
  61. }
  62.  
  63. $sql = "INSERT IGNORE INTO products
  64. (productNumber, productName,price)
  65. VALUES ('3', '4k Retina','$1000')";
  66. if ($conn->query($sql) == TRUE){
  67. //echo "insert has been created!\n";
  68. }
  69. else{
  70. //echo "Error creating insert!";
  71. }
  72.  
  73. $sql = "INSERT IGNORE INTO products
  74. (productNumber, productName,price)
  75. VALUES ('4', 'Curved Flatscreen','$1500')";
  76. if ($conn->query($sql) == TRUE){
  77. //echo "insert has been created!\n";
  78. }
  79. else{
  80. //echo "Error creating insert!";
  81. }
  82.  
  83. $sql = "INSERT IGNORE INTO products
  84. (productNumber, productName,price)
  85. VALUES ('5', '5k Flatscreen','$2000')";
  86. if ($conn->query($sql) == TRUE){
  87. //echo "insert has been created!\n";
  88. }
  89. else{
  90. //echo "Error creating insert!";
  91. }
  92.  
  93. //Get all data into its own arrays
  94. $product_numbers = array();
  95. $product_names = array();
  96. $prices = array();
  97. $sql = "SELECT * FROM products";
  98. $result = $conn->query($sql);
  99. while($row = $result->fetch_assoc()){
  100. $product_numbers[] = $row['productNumber'];
  101. $product_names[] = $row['productName'];
  102. $prices[] = $row['price'];
  103. }
  104.  
  105. $conn->close();
  106.  
  107. ?>
  108. </head>
  109. <body>
  110. <form name="QUIZ3" action="">
  111. <p>Contact Information</p>
  112. <input name="First Name" placeholder="First Name" type="text"><input name="Middle Initial"
  113. placeholder="Middle Initial"
  114. maxlength="1"
  115. type="text"><input
  116. name="Last Name"
  117. placeholder="Last Name"
  118. type="text"><input
  119. name="Email"
  120. placeholder="Email Address"
  121. type="text"><input
  122. name="Phone Number"
  123. placeholder="Phone Number"
  124. type="tel">
  125. <p>Address</p>
  126. <p><input name="Address" placeholder="Street" type="text"><input name="City"
  127. placeholder="City"
  128. type="text"><input
  129. name="State"
  130. placeholder="State"
  131. type="text"><input
  132. name="Zip"
  133. placeholder="Zip Code"
  134. maxlength="5"
  135. type="text"></p>
  136. <p>Email</p>
  137. <p><input name="Email" placeholder="Email" type="text"></p>
  138. <p>Phone Number</p>
  139. <p><input name="Phone Number" placeholder="Phone Number" type="text"></p>
  140. <input value="1" name="formselector" onclick="displayForm(this)" type="radio"> Credit Card <br>
  141. <input value="2" name="formselector" onclick="displayForm(this)" type="radio">Paypal<br>
  142. <input value="3" name="formselector" onclick="displayForm(this)" type="radio">Check<br>
  143. <input value="4" name="formselector" onclick="displayForm(this)" type="radio">Bitcoin<br>
  144. <input value="5" name="formselector" onclick="displayForm(this)" type="radio">Ether<br>
  145. <input value="6" name="formselector" onclick="displayForm(this)" type="radio">Ripple
  146. <p> Special Instructions</p>
  147. <p><textarea name="text" placeholder="Have any special shipping Instructions?"></textarea>&nbsp;
  148. </p>
  149. <select name="values" onchange="calcTotal(this.value)">
  150. <option value="1"><?php echo "Product Number $product_numbers[0]: $product_names[0]-$prices[0]"?></option>
  151. <option value="2"><?php echo "Product Number $product_numbers[1]: $product_names[1]-$prices[1]"?></option>
  152. <option value="3"><?php echo "Product Number $product_numbers[2]: $product_names[2]-$prices[2]"?></option>
  153. <option value="4"><?php echo "Product Number $product_numbers[3]: $product_names[3]-$prices[3]"?></option>
  154. <option value="5"><?php echo "Product Number $product_numbers[4]: $product_names[4]-$prices[4]"?></option>
  155. </select>
  156. <input name="OrderNumber" min="1" max="100" type="number"> <- Quantity<br>
  157. <p>Payment: </p>
  158. <br><br>
  159. <input name ="Submit" value = "Submit Payment" type = "reset">
  160. <input name="Reset" value="Reset Form" type="reset">
  161. <p>
  162. <script type="text/javascript">
  163. function displayForm(val) {
  164. if (val.value == "1") {
  165. document.getElementById("creditCard").style.visibility = 'visible';
  166. document.getElementById("payPal").style.visibility = 'hidden';
  167. document.getElementById("check").style.visibility = 'hidden';
  168. document.getElementById("BTC").style.visibility = 'hidden';
  169. document.getElementById("ETH").style.visibility = 'hidden';
  170. document.getElementById("XRP").style.visibility = 'hidden';
  171. }
  172. else if (val.value == "2") {
  173. document.getElementById("creditCard").style.visibility = 'hidden';
  174. document.getElementById("payPal").style.visibility = 'visible';
  175. document.getElementById("check").style.visibility = 'hidden';
  176. document.getElementById("BTC").style.visibility = 'hidden';
  177. document.getElementById("ETH").style.visibility = 'hidden';
  178. document.getElementById("XRP").style.visibility = 'hidden';
  179.  
  180. }
  181. else if (val.value == "3") {
  182. document.getElementById("creditCard").style.visibility = 'hidden';
  183. document.getElementById("payPal").style.visibility = 'hidden';
  184. document.getElementById("check").style.visibility = 'visible';
  185. document.getElementById("BTC").style.visibility = 'hidden';
  186. document.getElementById("ETH").style.visibility = 'hidden';
  187. document.getElementById("XRP").style.visibility = 'hidden';
  188. }
  189. else if (val.value == "4") {
  190. document.getElementById("creditCard").style.visibility = 'hidden';
  191. document.getElementById("payPal").style.visibility = 'hidden';
  192. document.getElementById("check").style.visibility = 'hidden';
  193. document.getElementById("BTC").style.visibility = 'visible';
  194. document.getElementById("ETH").style.visibility = 'hidden';
  195. document.getElementById("XRP").style.visibility = 'hidden';
  196. }
  197. else if (val.value == "5") {
  198. document.getElementById("creditCard").style.visibility = 'hidden';
  199. document.getElementById("payPal").style.visibility = 'hidden';
  200. document.getElementById("check").style.visibility = 'hidden';
  201. document.getElementById("BTC").style.visibility = 'hidden';
  202. document.getElementById("ETH").style.visibility = 'visible';
  203. document.getElementById("XRP").style.visibility = 'hidden';
  204. }
  205. else if (val.value == "6") {
  206. document.getElementById("creditCard").style.visibility = 'hidden';
  207. document.getElementById("payPal").style.visibility = 'hidden';
  208. document.getElementById("check").style.visibility = 'hidden';
  209. document.getElementById("BTC").style.visibility = 'hidden';
  210. document.getElementById("ETH").style.visibility = 'hidden';
  211. document.getElementById("XRP").style.visibility = 'visible';
  212. }
  213. else {}
  214. }
  215.  
  216. </script> </p>
  217. </form>
  218. <div style="visibility:hidden; position:relative" id="creditCard">
  219. <form id="ccform"> <label>Enter your credit card details :</label> <br>
  220. <br>
  221. <dd>
  222. <p>Name: <input id="ccname" name="ccname" value=""
  223. type="text"> </p>
  224. <p>Credit Card Vendor:
  225. <select name="cctype" required="">
  226. <option value="Visa">Visa</option>
  227. <option value="American Express">American Express</option>
  228. <option value="Discover">Discover</option>
  229. <option value="Mastercard">Mastercard</option>
  230. </select>
  231. </p>
  232. <p>Credit Card Number : <input minlength="16" maxlength="16" id="ccnumber" name="ccnumber" value="$ccnumber"type="text"></p>
  233. <p>Experation:
  234. <br><br> Month :
  235. <select name="month" required="">
  236. <option value="1">1</option>
  237. <option value="2">2</option>
  238. <option value="3">3</option>
  239. <option value="4">4</option>
  240. <option value="5">5</option>
  241. <option value="6">6</option>
  242. <option value="7">7</option>
  243. <option value="8">8</option>
  244. <option value="9">9</option>
  245. <option value="10">10</option>
  246. <option value="11">11</option>
  247. <option value="12">12</option>
  248. </select>
  249. <span>Year :
  250. <select name="year" required="">
  251. <option value="2009">2009</option>
  252. <option value="2010">2010</option>
  253. <option value="2011">2011</option>
  254. <option value="2012">2012</option>
  255. </select>
  256. </span> </p>
  257. <p>CVC : <input minlength="3" id="cccvc" name="cccvc" value="" type="text">
  258. </p>
  259. </dd>
  260. </form>
  261. </div>
  262.  
  263. <div style="visibility:hidden;position:relative;top:-110px;margin-top:-110px"
  264. id="payPal">
  265. <form id="paypalform"> <label>Paypal Account:</label> <bx
  266. <br>
  267. <dd>Account: <input id="paypal" name="paypal" value="" type="text">
  268. </dd>
  269. </form>
  270. </div>
  271. <div style="visibility:hidden;position:relative;top:-90px;margin-top:-90px"
  272. id="check">
  273. <form id="checkform"> <label> Make all checks payable to Karl Marx. 123 Sieze the Means Street. </label> <br>
  274. </form>
  275. </div>
  276. <div style="visibility:hidden;position:relative;top:-110px;margin-top:-110px"
  277. id="payPal">
  278. <br>
  279. <form id="BTC"><label>Our BTC wallet adress is: 1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa
  280. </label> <br>
  281. <br>
  282. </form>
  283. </div>
  284. <div style="visibility:hidden;position:relative;top:-110px;margin-top:-110px"
  285. id="payPal">
  286. <br><br><br><br>
  287. <form id="ETH"><label>Our ETH wallet adress is: 0xe99356bde974bbe08721d77712168fa070aa8da4
  288. </label> <br>
  289. <br>
  290. </form>
  291. </div>
  292. <div style="visibility:hidden;position:relative;top:-110px;margin-top:-110px"
  293. id="payPal"><br><br><br><br>
  294. <form id="XRP"><label>Our XRP wallet adress is: rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh
  295. </label> <br>
  296. <br>
  297. </form>
  298. </div>
  299. </body>
  300. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement