Advertisement
Guest User

corrections

a guest
Jul 11th, 2017
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.73 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3.  
  4. <head>
  5.   <meta charset="utf-8">
  6.   <meta name="viewport" content="width=device-width, initial-scale=1.0">
  7.   <meta name="description" content="">
  8.   <meta name="keywords" content="">
  9.   <meta name="generator" content="Responsive Site Designer 1.5.1419">
  10.   <title>Share to teach</title>
  11.   <link rel="stylesheet" href="css/coffeegrinder.min.css">
  12.   <link rel="stylesheet" href="css/wireframe-theme.min.css">
  13.   <script>document.createElement( "picture" );</script>
  14.   <script src="js/picturefill.min.js" class="picturefill" async="async"></script>
  15.   <link rel="stylesheet" href="css/main.css">
  16. </head>
  17.  
  18. <?php
  19.   $name = $_POST["myname"];
  20.   $surname = $_POST["mysurname"];
  21.   $email = $_POST["myemail"];
  22.   $username = $_POST["myusername"];
  23.   $password = $_POST["pass1"];
  24.   $country = $_POST["mycountry"];
  25.  
  26.   //On the line below, there is a mistake with an open bracket (
  27.   //Remove it
  28.   $city = ($_POST["mycity"];
  29.   $type = $_POST["mytype"];
  30.   $school = $_POST["myschool"];
  31.  
  32.   print($name);
  33.  
  34.  
  35. require_once("dd.php");
  36.  
  37. //Now that config.php is part of this file. It will suffice to use $db as the connection variable
  38. // or you can still assing $conn = $db and work
  39.  
  40. //In case you decided to use $connection = mysqli_connect(...)
  41. ///Then you can check here with $connection
  42.  
  43. if (!$conn) {
  44.     die('Connect Error: ' . mysqli_connect_error());
  45. }
  46.  
  47.  
  48. //In your insert statement here. You are not suppose to have double quates around variables.
  49. // That is where you have values. they are suppose to be single quotes
  50. //Inserting double quotes fits those values as strings. and not their content
  51. mysqli_query($conn,"INSERT INTO `users`( `user_name`, `password`, `first_name`, `last_name`, `school`, `email`, `country`, `city`)
  52. VALUES ('"$username"','"$password"','"$name"','"$surname"','"$school"','"$email"','"$country"','"$city"')");
  53.  
  54. /*
  55. Try any of these two options
  56. $query = mysqli_query("INSERT INTO `users` (`user_name`, `password`, `first_name`, `last_name`, `school`, `email`, `country`, `city`)
  57.     VALUES ('$username', '$password', '$name', '$surname', '$school', '$email', '$country', '$city');
  58.    
  59. $result = mysqli_query($conn, $query);
  60.  
  61. //Or you can still use this
  62. mysqli_query($conn, "INSERT INTO `users` (`user_name`, `password`, `first_name`, `last_name`, `school`, `email`, `country`, `city`)
  63.     VALUES ('$username', '$password', '$name', '$surname', '$school', '$email', '$country', '$city');
  64.    
  65.     */
  66. mysqli_close($conn);
  67.  
  68. ?>
  69.  
  70. <html>
  71.  
  72. <form align="left" name="form1" method="onload" action="index.html">
  73.  
  74. </html>
  75.  
  76. <script>
  77.  alert("The form was submitted");
  78. </script>
  79.  
  80. <div id='fg_membersite_content'>
  81. <h2>Follow link to log in</h2>
  82. <ul>
  83. <li><a href='login.php'>Login</a></li>
  84. </ul>
  85. </div>
  86. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement