問題はinsertRecord.phpにありますが、それを見つけることができません.iエラーの画像も添付されていますNotice:未定義の変数:ファーストネームC: xampp htdocs port w6 insertRecord.php on line 16
問題はinsertRecord.phpであるが、私はit.iを見つけることができませんが、エラー
未定義変数のイメージをも付いていますFIRSTNAME、姓、パスワード、電子メール、年齢、性別は問題
insertRecord.php
<?php
include 'connection.php';
if(isset($_POST['submit']))
{
echo"sucee";
$firstname = $_POST['firstname'];
$lastname = $_POST['lastname'];
$email = $_POST['email'];
$password = $_POST['password'];
$gender = $_POST['gender'];
$age = $_POST['age'];
}
$sql = "INSERT INTO user (FirstName,LastName,Email,Password,Gender,Age) VALUES ('$firstname', '$lastname', '$email', '$password', '$gender', '$age')";
$result=mysqli_query($connection, $sql);
include 'watWK6.php';
include 'selectRecord.php';
?>
接続
<?php
$hostname = 'localhost';
$username = 'root';
$password = '';
$databaseName = 'c7181378';
$connection = mysqli_connect($hostname, $username, $password, $databaseName) or exit("Unable to connect to database!");
?>
watWK6.php
<!DOCTYPE html>
<html lang="en">
<head>
<title>Web Applications and Technologies</title>
<link type="text/css" rel="stylesheet" href="main.css" />
</head>
<body>
<header>
<h1> C7181378</h1>
</header>
<section id="container">
<form method = "POST" action = "insertRecord.php">
<fieldset>
<legend> Enter Customer Details </legend>
<label> First Name: </label>
<input type = "text" name = "firstname"/>
<br/>
<label> Surname: </label>
<input type = "text" name = "lastname"/>
<br/>
<label> Email: </label>
<input type = "text" name = "email"/>
<br/>
<label> Password: </label>
<input type = "password" name = "password"/>
<br/>
<label> Gender: </label>
<select name = "gender">
<option value = "M"> Male </option>
<option value = "F"> Female </option>
</select>
<br/>
<label> Age: </label>
<input type = "text" name = "age"/>
<br/>
<input type = "submit" value = "submit" name = "submit"/>
</fieldset>
</form>
</section>
<footer>
<small> <a href="../index.html">Home</a></small>
</footer>
</body>
</html>
<?php
include 'selectRecord.php';
?>
'if'文内でクエリ部分を移動する –
非難され、安全でない** mysql *関数**を使用しないでください。 PHP 5.5(2013年)以降** **非推奨となり、PHP 7(2015年)では完全に削除されました。代わりにMySQLiまたはPDOを使用してください。 2.あなたは** [SQL Injections](http://php.net/manual/en/security.database.sql-injection.php)**を広く読んでおり、実際には[Prepared Statements](http: /php.net/manual/en/mysqli.quickstart.prepared-statements.php)を使用してください。これは上記のMySQLiまたはPDOを使用する場合に使用できます。 –