Jump to content

Form is submitting to page


phreak3r
 Share

Go to solution Solved by Barand,

Recommended Posts

Hi there PHPFreaks, phreak3r here again. The thread I posted yesterday has been solved. If any staff come across this, please lock it to prevent further discussion; I would appreciate that, please and thank you! I am back with another problem! This forum is all contained in one page. I am doing a very basic login system for now (I will add in everything else in later) and it does not work. I go to submit the forum and the values are displayed in the url after the page refreshes. Here's the code for the login.php script involved:

<?php
  2 include('header.php');
  3 require('dbcon/dbcon.php');
  4 ?>
  5 
  6 <?php
  7     if (isset($_POST['submit'])) {
  8         $username = mysqli_real_escape_string($conn, $_POST['username']);
  9         $password = mysqli_real_escape_string($conn, $_POST['password']);
 10         $sql = "SELECT * FROM profile0 WHERE username = '$username' ";
 11         $query = mysqli_query($conn, $sql);
 12         
 13         if (mysqli_num_rows($query) == 1) {
 14             // init session
 15             // redirect to new page
 16             header('main.php');
 17         }
 18     }
 19 ?>
 20 
 21 <!DOCTYPE html>
 22 <html>
 23     <head>
 24         <title>soapbox - log in</title>
 25     </head>
 26     <body>
 27         <form action="login.php" method"POST">
 28             <br><input type="text" name="username" placeholder="Username"><br>
 29             <br><input type="password" name="password" placeholder="Password"><br>
 30             <input type="submit" name="submit" value="Submit">
 31         </form>
 32     </body>
 33 </html>

EDIT: No errors in the error log.

Edited by phreak3r
Link to comment
Share on other sites

This thread is more than a year old.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.