Guest User

Untitled

a guest
Aug 1st, 2018
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.15 KB | None | 0 0
  1. <?include("database.php");?>
  2. <html>
  3. <head>
  4. <title>Home</title>
  5. <link rel = "Stylesheet" type = "text/css" href = "Style.css" />
  6.  
  7. </head>
  8. <body>
  9.  
  10. <div class = "header">
  11. <table class = "tableHeader">
  12. <tr>
  13. <th>
  14. <img src = "images/header.jpg" alt = "Header" align = "center"/>
  15. </th>
  16. </tr>
  17. </table>
  18. </div>
  19.  
  20. <div class = "div1">
  21. <a href = "index.php">Home |</a>
  22. <a href = "Home.htm">| Login</a>
  23. </div>
  24.  
  25. <div class = "div2">
  26. <a href = "products.php">Products|</a>
  27. <a href = "search.php">|Search|</a>
  28. <a href = "shopping_cart.php">|Shopping Cart|</a>
  29. <a href = "user_details.php">|User Details|</a>
  30. <a href = "registration.php">|Registration</a>
  31. </div>
  32.  
  33. <h1>Registration</h1>
  34.  
  35. <div class = "div3">
  36. <form action = "success.php" method = "post">
  37. <table class = "table1" cellspacing = "5px">
  38. <tr class = "tr_p">
  39. <th>User ID*:</th>
  40. <th><input type = "text" name = "user_id" id = "user_id" size = "20"/></th>
  41. <th> </th>
  42. </tr>
  43.  
  44. <tr class = "tr_p">
  45. <th>Password*:</th>
  46. <th><input type = "password" name = "password" id = "password"/></th>
  47. <th> </th>
  48. </tr>
  49.  
  50. <tr class = "tr_p">
  51. <th>Confirm password*:</th>
  52. <th><input type = "password" name = "password2" id = "password2"/></th>
  53. <th> </th>
  54. </tr>
  55.  
  56.  
  57. <tr class = "tr_p">
  58. <th>First Name*:</th>
  59. <th><input type = "text" name = "fname" id = "fname" <?$fname = $_POST['fname'];?>/></th>
  60. <th> </th>
  61. </tr>
  62.  
  63.  
  64. <tr class = "tr_p">
  65. <th>Last Name:</th>
  66. <th><input type = "text" name = "lname" id = "lname"/></th>
  67. <th> </th>
  68. </tr>
  69.  
  70. <tr class = "tr_p">
  71. <th>Address*:</th>
  72. <th><input type = "text" name = "address" id = "address"/></th>
  73. <th> </th>
  74. </tr>
  75.  
  76. <tr class = "tr_p">
  77. <th>City*:</th>
  78. <th><input type = "text" name = "city" id = "city"/></th>
  79. <th> </th>
  80. </tr>
  81.  
  82. <tr class = "tr_p">
  83. <th>Zip Code*:</th>
  84. <th><input type = "text" maxlength = "5" name = "zipcode" id = "zipcode"/></th>
  85. <th style = "color:Red">Required</th>
  86. </tr>
  87.  
  88. <tr class = "tr_p">
  89. <th>State*:</th>
  90. <th align = "center">
  91. <select name = "state" id = "state">
  92. <optgroup label = "state">
  93. <option></option>
  94. <option>PR</option>
  95. </optgroup>
  96. </select>
  97. </th>
  98. <th> </th>
  99. </tr>
  100.  
  101. <tr class = "tr_p">
  102. <th>Email*:</th>
  103. <th><input type = "text" name = "email" id = "email"/></th>
  104. <th> </th>
  105. </tr>
  106.  
  107. <tr class = "tr_p">
  108. <th>Phone Number*:</th>
  109. <th><input type = "text" maxlength = "10" name = "phone" id = "phone"/></th>
  110. <th> </th>
  111. </tr>
  112.  
  113. </table>
  114.  
  115. <input type = "submit" /><input type = "reset" />
  116.  
  117. <?php
  118. $userid = $_POST['user_id'];
  119. $password = $_POST['password'];
  120. $fname = $_POST['fname'];
  121. $lname = $_POST['lname'];
  122. $address = $_POST['address'];
  123. $city = $_POST['city'];
  124. $zipcode = $_POST['zipcode'];
  125. $state = $_POST['state'];
  126. $email = $_POST['email'];
  127. $phone = $_POST['phone'];
  128.  
  129. $db_servername = "localhost";
  130. $db_username = "root";
  131. $db_password = "";
  132. $db_name = "online_store";
  133.  
  134. $db = mysql_connect($db_servername, $db_username, $db_password) or die("Could not connect to database");
  135. mysql_select_db($db_name);
  136.  
  137. $query = "INSERT INTO online_store.customer('User_ID', 'Password', 'First_Name', 'Last_Name',
  138. 'Address', 'City', 'ZipCode', 'State', 'Email_Address', 'Phone_number)
  139. VALUES('$userid', '$password', $fname', '$lname', '$address',
  140. '$city', '$zipcode', '$state', '$email', '$phone');";
  141.  
  142. mysql_query($insert) or die ('Error, could not update database');
  143.  
  144.  
  145. ?>
  146.  
  147. </form>
  148. </div>
  149.  
  150.  
  151. <div class = "footer">
  152. <table class = "tableHeader">
  153. <tr>
  154. <th>
  155. <img src = "images/footer.jpg" alt = "Header" align = "center"/>
  156. </th>
  157. </tr>
  158. </table>
  159. </div>
  160.  
  161.  
  162. </body>
  163. </html>
Add Comment
Please, Sign In to add comment