次のコードを使用してデータを挿入しようとしましたが、結果を取得する方法とコードの問題が本当にわかりません。最初にフォームを作成してから、挿入クエリを作成して送信します新しいフォーム、ヘルプをお願いします:また、次のエラーがあります:
注意: 未定義のインデックス: Services in C:\xampp\htdocs\ers\test.php 行 11
注意: 未定義のインデックス: C:\xampp\htdocs\ers\test.php の 12 行目のタイトル
注意: 未定義のインデックス: 13 行目の C:\xampp\htdocs\ers\test.php の RootCause
注意: 未定義のインデックス: C:\xampp\htdocs\ers\test.php の 14 行目の RiskRating
注意: 未定義のインデックス: 15 行目の C:\xampp\htdocs\ers\test.php の影響
注意: 未定義のインデックス: Efforts in C:\xampp\htdocs\ers\test.php の 16 行目
注意: 未定義のインデックス: C:\xampp\htdocs\ers\test.php の 17 行目の可能性
注意: 未定義のインデックス: C:\xampp\htdocs\ers\test.php の 18 行目で検索
注意: 未定義のインデックス: 19 行目の C:\xampp\htdocs\ers\test.php の意味
Notice: Undefined index: Recommendation in C:\xampp\htdocs\ers\test.php on line 20 Error: Cannot add or update a child row: aforeign key constraint fails ( ers_1
. findings
, CONSTRAINT findings_ibfk_15
FOREIGN KEY ( ServiceType_ID
) REFERENCES servicetype_lookup
( ServiceType_ID
) ON UPDATE何もしない)
<html>
<body>
<?php
$con = mysql_connect("localhost","root","123");
error_reporting(0);
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
?>
<form method="post" action="test.php">
<fieldset>
<legend>Insert New Data </legend>
<p> Service Name :
<select name="Services">
<option value="select"> -Select- </option>
<option value="architecture review">Architecture Review</option>
<option value="internal penetration testing">Internal Penetration Testing</option>
<option value="network component review">Network Component Review</option>
<option value="database review">Database Review</option>
<option value="wireless network">Wireless Network</option>
<option value="operating system review">Operating System Review</option>
<option value="web application">Web Application</option>
<option value="external penetration testing">External Penetration Testing</option>
</select>
</p>
<form method="post" action="test.php">
Ref : <input type="text" name="ref" /><br />
Title : <input type="text" name="title" /><br />
Risk Rating :
<select name="RiskRating">
<option value="select"> -Select- </option>
<option value="High">High</option>
<option value="Medium">Medium</option>
<option value="Low">Low</option>
</select><br />
Root Cause :
<select name="RootCause">
<option value="select"> -Select- </option>
<option value="access control">Access Control</option>
<option value="configuration management">Configuration Management</option>
<option value="patch management">Patch Management</option>
<option value="patch management">Certificate Management</option>
<option value="patch management">Password Management</option>
<option value="patch management">Audit Trail and Security Logs Management</option>
<option value="service deployment">Network Management</option>
</select><br />
Impact :
<select name="impact">
<option value="select"> -Select- </option>
<option value="high"> Major </option>
<option value="moderate"> Moderate </option>
<option value="low"> Minor </option>
</select><br />
Likelihood :
<select name="likelihood">
<option value="select"> -Select- </option>
<option value="possible"> Likely </option>
<option value="impossible">Possible</option>
<option value="definite"> Moderate </option>
<option value="definite"> Rare </option>
</select><br/>
Efforts :
<select name="Efforts">
<option value="select"> -Select- </option>
<option value="possible"> Significant </option>
<option value="impossible">Moderate </option>
<option value="definite"> Intermediate </option>
<option value="definite"> Simple </option>
</select><br/>
Finding : <br/>
<TEXTAREA NAME="Finding" COLS=100 ROWS=10>
</TEXTAREA>
<br/>
Implication: <br/>
<TEXTAREA NAME="Implication" COLS=100 ROWS=10>
</TEXTAREA>
<br/>
Recommendation : <br/>
<TEXTAREA NAME="Recommendation" COLS=100 ROWS=10>
</TEXTAREA>
<br/><input type="submit" value=" Save " onclick="window.location.href='test.php'" />
</fieldset>
</form>
<?php
mysql_select_db("ers_1", $con);
$result = mysql_query("SELECT * FROM findings");
while($row = mysql_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $row['Finding_ID'] . "</td>";
echo "<td>" . $row['ServiceType_ID'] . "</td>";
echo "<td>" . $row['Title'] . "</td>";
echo "<td>" . $row['RootCause_ID'] . "</td>";
echo "<td>" . $row['RiskRating_ID'] . "</td>";
echo "<td>" . $row['Impact_ID'] . "</td>";
echo "<td>" . $row['Efforts_ID'] . "</td>";
echo "<td>" . $row['Likelihood_ID'] . "</td>";
echo "<td>" . $row['Finding'] . "</td>";
echo "<td>" . $row['Implication'] . "</td>";
echo "<td>" . $row['Recommendation'] . "</td>";
echo "<td>" . $row['Report_ID'] . "</td>";
echo "<td><a href='edit.php'>[EDIT]</a> <a href='delete_risk.php?risk_no=" . $row['risk_no'] . "'>[DELETE]</a></td>";
echo "</tr>";
}
mysql_close($con);
?>
</body>
</html>