• User Newbie

    form php

    salve non riesco a capir perchè nella form della login qualcuno mi può aiutare? questo è il codice
    $servername = "localhost";
    $username = "root";
    $password = "root";
    $dbname = "Db_NiukoWeb";

    // Create connection
    $conn = new mysqli($servername, $username, $password, $dbname);
    // Check connection
    if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);


    $sql = "SELECT Id_Utente, Username_Utente, Password_Utente FROM Tab_Utenti where Username_Utente='$u' AND Password_Utente='$p'";

    $result = $conn->query($sql);

    if ($result->num_rows > 0) {

    //output data of each row
    while($row = $result->fetch_assoc()) {
         $messaggio_html="<span style='color:green'><center><b>BENVENUTO! " . $row["Username_Utente"]. "</b></center></span>";
    //echo "id: " . $row["Id_Utente"]. " - Name: " . $row["Username_Utente"]. " " .$row["Password_Utente"]. "<br>";

    } else {

    $messaggio_html="<span style='color:red'><center><b>DATI NON CORRETTI</b></center></span>";



    <!DOCTYPE html>

    	<link rel="icon" href="img/favicon.png" type="image/png"/>
    	<title> login - NiuWeb </title>
    	<meta charset="UTF-8">
    	<meta name="description"content="Prima pag. corso Dev PHP Niuko 2017">
    	<meta name="keywords"content="HTML,CSS,Javascript,jQuery">
    	<meta name="author" content="Valentina Zilio">
    	<meta name="generator" content="Blocco Notes e Notepad++">
    	<meta name="viewport" content="width=devic-width, initial-scale=1.0">
    	<link rel="stylesheet" href="css/style.css" type="text/css">

    <div class="login-main">
    <div class="login_logo">
    <img src="img/login_ab.png"/>

    		<div class="login_form">
    			<form id="login_form" name="login_form" method="post">
    			        <input type="text" name="username" id="username" placeholder="Username or email"  autocomplete="on" required>
    			        <input type="password" name='password' placeholder="Password"  id="password" required> 
    			    	<input type="submit" name="submit" value="ENTRA" id="btnLogin">
    					<?php echo $messaggio_html; ?>



  • ModSenior

    Chiudo la discussione in quanto doppia.