<html> <head> <title>My First PHP Website</title> </head> <body> <h2>Registration Page</h2> <a href="index.php">Click here to go back</a><br/> <form action="register.php" method="post"> Enter Username: <input type="text" name="username" required="required"/><br/> Enter Password: <input type="password" name="password" required="required"/><br/> <input type="submit" value="Register"/> </form> </body> </html> <?php if($_SERVER["REQUEST_METHOD"] == "POST"){ $username = mysql_real_escape_string($_POST['username']); $password = mysql_real_escape_string($_POST['password']); echo "Username entered is:". $username . "<br/>"; echo "Password entered is:". $password; } ?>
mysql_real_escape_string
mysql_real_escape_string[^]: Warning This extension was deprecated in PHP 5.5.0, and it was removed in PHP 7.0.0. Instead, the MySQLi[^] or PDO_MySQL[^] extension should be used. See also MySQL: choosing an API[^] guide and related FAQ[^] for more information. Alternatives to this function include: mysqli_real_escape_string()[^] PDO::quote()[^]
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)