1

When i Click to submit - No reaction ! Help please ! PHP Form Not Work

I think error in form, please, check for first action and form connectedness

Login.php


<link rel="stylesheet" href="style.css">
<div class="frm">
    <form action="action.php" method="POST" class="log" id="log">

        <h4>Log In</h4>

        <label for="loginl"> Username: </label>
        <input type="login" name="loginl" id="login">

        <label for="password"> Password: </label>
        <input type="password" name="password" id="password">

        <label for="password"> Mail: </label>
        <input type="mail" name="mail" id="mail">

        <input type="button" value="Submit" id="button">

    </form>
</div>

Action.php

<?php

    $loginl = $_POST["loginl"];
    $password = $_POST["password"];
    $mail = $_POST["mail"];
    $text = $_POST["text"];


    $loginl = stripcslashes($loginl);
    $password = stripcslashes($password);
    $mail = stripcslashes($mail);
    $text = stripcslashes($text);

    $loginl = mysql_real_escape_string($loginl);
    $password = mysql_real_escape_string($password);
    $mail = mysql_real_escape_string($mail);
    $text = mysql_real_escape_string($text);


    $db = mysql_connect("localhost", "root", "usbw", "armus");
    mysql_set_charset($db, "utf8");

    $result = mysql_query("SELECT * from users where loginl = '$loginl' and password = '$password' and mail = '$mail'") or die("Failed to query database ".mysql_error());

    $row = mysql_fetch_array($result);
    if ($row['loginl'] == $loginl && $row["password"] == $password && $row["mail"] == $mail){
        echo "Login Success!!! Welcome ". $row['text'] ;
    } else {
        echo "failed to login!";
    }

?>

output - NO RESULT

My PHP version - 5.4.17

where is my mistake?

Thom A
  • 88,727
  • 11
  • 45
  • 75
  • 1
    ***Please [stop using `mysql_*` functions](http://stackoverflow.com/questions/12859942/why-shouldnt-i-use-mysql-functions-in-php).*** [These extensions](http://php.net/manual/en/migration70.removed-exts-sapis.php) have been removed in PHP 7. Learn about [prepared](http://en.wikipedia.org/wiki/Prepared_statement) statements for [PDO](http://php.net/manual/en/pdo.prepared-statements.php) and [MySQLi](http://php.net/manual/en/mysqli.quickstart.prepared-statements.php) and consider using PDO, [it's really pretty easy](http://jayblanchard.net/demystifying_php_pdo.html). – Jay Blanchard Mar 29 '19 at 11:22
  • 1
    I think a submit button is missing. `` – KIKO Software Mar 29 '19 at 11:23
  • 1
    You need a submit input, buttons will not work on their own. A button input will need additional help. – Jay Blanchard Mar 29 '19 at 11:23
  • Jay Blanchard And what can i use??? if not mysql_??? – Mkrtumian Arseni Mar 29 '19 at 11:34
  • There are two suggestions in the original comment. Please click the links and read them. – Jay Blanchard Mar 29 '19 at 11:36
  • okay thanks but now i have this errors - Warning: mysqli_query() expects at least 2 parameters, 1 given in D:\vebserver php\root\Arsen\ArmMus.com\login\action.php on line 20 Warning: mysqli_error() expects exactly 1 parameter, 0 given in D:\vebserver php\root\Arsen\ArmMus.com\login\action.php on line 20 – Mkrtumian Arseni Mar 29 '19 at 11:40

0 Answers0