Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <title>TV STORE JUSTIN CHUDLEY</title>
- <?php
- $servername = "localhost";
- $username = "root";
- $password = "root";
- $conn = new mysqli($servername, $username, $password);
- if($conn ->connect_error){
- die("Could not connect: " . $conn->connect_error);
- }
- $conn->select_db("tv_store");
- //CREATE DB IF db does not exist
- $sql = 'CREATE DATABASE IF NOT EXISTS tv_store';
- if($conn->query($sql) == TRUE){
- //echo "Database created!\n";
- }
- else{
- //echo 'Error: ' . $conn->error . "\n";
- }
- //CREATE TABLE IF table does not exist
- $sql = "CREATE TABLE IF NOT EXISTS products
- (
- productNumber INT(6) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
- productName VARCHAR(30) NOT NULL,
- price VARCHAR(30) NOT NULL
- )";
- if ($conn->query($sql) == TRUE){
- //echo "Table has been created!\n";
- }
- else{
- //echo "Error creating table!";
- }
- //INSERT Data IF data is not already inserted
- $sql = "INSERT IGNORE INTO products
- (productNumber, productName,price)
- VALUES ('1', 'Plasma','$500')";
- if ($conn->query($sql) == TRUE){
- //echo "insert has been created!\n";
- }
- else{
- //echo "Error creating insert!";
- }
- $sql = "INSERT IGNORE INTO products
- (productNumber, productName,price)
- VALUES ('2', 'Flatscreen','$750')";
- if ($conn->query($sql) == TRUE){
- //echo "insert has been created!\n";
- }
- else{
- //echo "Error creating insert!";
- }
- $sql = "INSERT IGNORE INTO products
- (productNumber, productName,price)
- VALUES ('3', '4k Retina','$1000')";
- if ($conn->query($sql) == TRUE){
- //echo "insert has been created!\n";
- }
- else{
- //echo "Error creating insert!";
- }
- $sql = "INSERT IGNORE INTO products
- (productNumber, productName,price)
- VALUES ('4', 'Curved Flatscreen','$1500')";
- if ($conn->query($sql) == TRUE){
- //echo "insert has been created!\n";
- }
- else{
- //echo "Error creating insert!";
- }
- $sql = "INSERT IGNORE INTO products
- (productNumber, productName,price)
- VALUES ('5', '5k Flatscreen','$2000')";
- if ($conn->query($sql) == TRUE){
- //echo "insert has been created!\n";
- }
- else{
- //echo "Error creating insert!";
- }
- //Get all data into its own arrays
- $product_numbers = array();
- $product_names = array();
- $prices = array();
- $sql = "SELECT * FROM products";
- $result = $conn->query($sql);
- while($row = $result->fetch_assoc()){
- $product_numbers[] = $row['productNumber'];
- $product_names[] = $row['productName'];
- $prices[] = $row['price'];
- }
- $conn->close();
- ?>
- </head>
- <body>
- <form name="QUIZ3" action="">
- <p>Contact Information</p>
- <input name="First Name" placeholder="First Name" type="text"><input name="Middle Initial"
- placeholder="Middle Initial"
- maxlength="1"
- type="text"><input
- name="Last Name"
- placeholder="Last Name"
- type="text"><input
- name="Email"
- placeholder="Email Address"
- type="text"><input
- name="Phone Number"
- placeholder="Phone Number"
- type="tel">
- <p>Address</p>
- <p><input name="Address" placeholder="Street" type="text"><input name="City"
- placeholder="City"
- type="text"><input
- name="State"
- placeholder="State"
- type="text"><input
- name="Zip"
- placeholder="Zip Code"
- maxlength="5"
- type="text"></p>
- <p>Email</p>
- <p><input name="Email" placeholder="Email" type="text"></p>
- <p>Phone Number</p>
- <p><input name="Phone Number" placeholder="Phone Number" type="text"></p>
- <input value="1" name="formselector" onclick="displayForm(this)" type="radio"> Credit Card <br>
- <input value="2" name="formselector" onclick="displayForm(this)" type="radio">Paypal<br>
- <input value="3" name="formselector" onclick="displayForm(this)" type="radio">Check<br>
- <input value="4" name="formselector" onclick="displayForm(this)" type="radio">Bitcoin<br>
- <input value="5" name="formselector" onclick="displayForm(this)" type="radio">Ether<br>
- <input value="6" name="formselector" onclick="displayForm(this)" type="radio">Ripple
- <p> Special Instructions</p>
- <p><textarea name="text" placeholder="Have any special shipping Instructions?"></textarea>
- </p>
- <select name="values">
- <option value=""><?php echo "Product Number $product_numbers[0]: $product_names[0]-$prices[0]"?></option>
- <option value=""><?php echo "Product Number $product_numbers[1]: $product_names[1]-$prices[1]"?></option>
- <option value=""><?php echo "Product Number $product_numbers[2]: $product_names[2]-$prices[2]"?></option>
- <option value=""><?php echo "Product Number $product_numbers[3]: $product_names[3]-$prices[3]"?></option>
- <option value=""><?php echo "Product Number $product_numbers[4]: $product_names[4]-$prices[4]"?></option>
- </select>
- <input name="OrderNumber" min="1" max="100" type="number"> <- Quantity<br>
- <p>Payment: </p>
- <br><br>
- <button onclick ="calcTotal()">Submit Payment</button>
- <input name="Reset" value="Reset Form" type="reset">
- <p>
- <script type="text/javascript">
- function calcTotal(val){
- var test = document.getElementByName('values');
- window.alert("TEST");
- }
- function displayForm(val) {
- if (val.value == "1") {
- document.getElementById("creditCard").style.visibility = 'visible';
- document.getElementById("payPal").style.visibility = 'hidden';
- document.getElementById("check").style.visibility = 'hidden';
- document.getElementById("BTC").style.visibility = 'hidden';
- document.getElementById("ETH").style.visibility = 'hidden';
- document.getElementById("XRP").style.visibility = 'hidden';
- }
- else if (val.value == "2") {
- document.getElementById("creditCard").style.visibility = 'hidden';
- document.getElementById("payPal").style.visibility = 'visible';
- document.getElementById("check").style.visibility = 'hidden';
- document.getElementById("BTC").style.visibility = 'hidden';
- document.getElementById("ETH").style.visibility = 'hidden';
- document.getElementById("XRP").style.visibility = 'hidden';
- }
- else if (val.value == "3") {
- document.getElementById("creditCard").style.visibility = 'hidden';
- document.getElementById("payPal").style.visibility = 'hidden';
- document.getElementById("check").style.visibility = 'visible';
- document.getElementById("BTC").style.visibility = 'hidden';
- document.getElementById("ETH").style.visibility = 'hidden';
- document.getElementById("XRP").style.visibility = 'hidden';
- }
- else if (val.value == "4") {
- document.getElementById("creditCard").style.visibility = 'hidden';
- document.getElementById("payPal").style.visibility = 'hidden';
- document.getElementById("check").style.visibility = 'hidden';
- document.getElementById("BTC").style.visibility = 'visible';
- document.getElementById("ETH").style.visibility = 'hidden';
- document.getElementById("XRP").style.visibility = 'hidden';
- }
- else if (val.value == "5") {
- document.getElementById("creditCard").style.visibility = 'hidden';
- document.getElementById("payPal").style.visibility = 'hidden';
- document.getElementById("check").style.visibility = 'hidden';
- document.getElementById("BTC").style.visibility = 'hidden';
- document.getElementById("ETH").style.visibility = 'visible';
- document.getElementById("XRP").style.visibility = 'hidden';
- }
- else if (val.value == "6") {
- document.getElementById("creditCard").style.visibility = 'hidden';
- document.getElementById("payPal").style.visibility = 'hidden';
- document.getElementById("check").style.visibility = 'hidden';
- document.getElementById("BTC").style.visibility = 'hidden';
- document.getElementById("ETH").style.visibility = 'hidden';
- document.getElementById("XRP").style.visibility = 'visible';
- }
- else {}
- }
- </script> </p>
- </form>
- <div style="visibility:hidden; position:relative" id="creditCard">
- <form id="ccform"> <label>Enter your credit card details :</label> <br>
- <br>
- <dd>
- <p>Name: <input id="ccname" name="ccname" value=""
- type="text"> </p>
- <p>Credit Card Vendor:
- <select name="cctype" required="">
- <option value="Visa">Visa</option>
- <option value="American Express">American Express</option>
- <option value="Discover">Discover</option>
- <option value="Mastercard">Mastercard</option>
- </select>
- </p>
- <p>Credit Card Number : <input minlength="16" maxlength="16" id="ccnumber" name="ccnumber" value="$ccnumber"type="text"></p>
- <p>Experation:
- <br><br> Month :
- <select name="month" required="">
- <option value="1">1</option>
- <option value="2">2</option>
- <option value="3">3</option>
- <option value="4">4</option>
- <option value="5">5</option>
- <option value="6">6</option>
- <option value="7">7</option>
- <option value="8">8</option>
- <option value="9">9</option>
- <option value="10">10</option>
- <option value="11">11</option>
- <option value="12">12</option>
- </select>
- <span>Year :
- <select name="year" required="">
- <option value="2009">2009</option>
- <option value="2010">2010</option>
- <option value="2011">2011</option>
- <option value="2012">2012</option>
- </select>
- </span> </p>
- <p>CVC : <input minlength="3" id="cccvc" name="cccvc" value="" type="text">
- </p>
- </dd>
- </form>
- </div>
- <div style="visibility:hidden;position:relative;top:-110px;margin-top:-110px"
- id="payPal">
- <form id="paypalform"> <label>Paypal Account:</label> <bx
- <br>
- <dd>Account: <input id="paypal" name="paypal" value="" type="text">
- </dd>
- </form>
- </div>
- <div style="visibility:hidden;position:relative;top:-90px;margin-top:-90px"
- id="check">
- <form id="checkform"> <label> Make all checks payable to Karl Marx. 123 Sieze the Means Street. </label> <br>
- </form>
- </div>
- <div style="visibility:hidden;position:relative;top:-110px;margin-top:-110px"
- id="payPal">
- <br>
- <form id="BTC"><label>Our BTC wallet adress is: 1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa
- </label> <br>
- <br>
- </form>
- </div>
- <div style="visibility:hidden;position:relative;top:-110px;margin-top:-110px"
- id="payPal">
- <br><br><br><br>
- <form id="ETH"><label>Our ETH wallet adress is: 0xe99356bde974bbe08721d77712168fa070aa8da4
- </label> <br>
- <br>
- </form>
- </div>
- <div style="visibility:hidden;position:relative;top:-110px;margin-top:-110px"
- id="payPal"><br><br><br><br>
- <form id="XRP"><label>Our XRP wallet adress is: rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh
- </label> <br>
- <br>
- </form>
- </div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement