我正在使用此脚本通过PHP表单更新我的MySQL数据库。但由于某种原因,我得到了通知:当我尝试更新时,未经编码的索引......有人能告诉我为什么我会收到错误。
未确定的指数:第75行的融合
<html>
<body>
<?php
$server="localhost";
$username="root";
$password="";
$connect_mysql=mysql_connect($server,$username,$password) or die ("Connection Failed!");
$mysql_db=mysql_select_db("helpdesk_middenpolder",$connect_mysql) or die ("Could not Connect to Database");
$query = "SELECT * FROM incidenten";
$result=mysql_query($query) or die("Query Failed : ".mysql_error());
$i=0;
while($rows=mysql_fetch_array($result))
{
$roll[$i]=$rows['incidentID'];
$i++;
}
$total_elmt=count($roll);
?>
<form method="POST" action="">
Select the Roll No. to Update: <select name="incidentID">
<option>Select</option>
<?php
for($j=0;$j<$total_elmt;$j++)
{
?><option><?php
echo $roll[$j];
?></option><?php
}
?>
</select><br />
<td>Hardwaretypen</td>
<td>:</td>
<td>
<select name="typen" id="typen" <?php //Include de pagina waar je config file staat
include 'dbconnectie.php';
//Query
$query = "SELECT typen FROM hardware_typen";
//Query uitvoeren
$uitvoeren = mysql_query($query);
//Begin van dropdown
echo '<select>';
//While voor data in de dropdown
while($rij = mysql_fetch_assoc($uitvoeren)) {
//De data in de dropdown zetten
echo '<option>'.$rij['typen'].'</option>';
}
//De dropdown beëindigen
echo '</select>';?></td>
Melding: <input name="marks" type="text" /><br />
<select name="naam" id="naam" <?php //Include de pagina waar je config file staat
include 'dbconnectie.php';
//Query
$query = "SELECT naam FROM gebruikers WHERE level='3'";
//Query uitvoeren
$uitvoeren = mysql_query($query);
//Begin van dropdown
echo '<select>';
//While voor data in de dropdown
while($rij = mysql_fetch_assoc($uitvoeren)) {
//De data in de dropdown zetten
echo '<option>'.$rij['naam'].'</option>';
}
//De dropdown beëindigen
echo '</select>';?></td>
<input name="submit" type="submit" value="Update"/><br />
<input name="reset" type="reset" value="Reset"/>
</form>
<?php
if(isset($_POST['submit']))
{
$value=$_POST['incidentID'];
$typen=$_POST['typen'];
$melding=$_POST['Melding'];
$naam=$_POST['naam'];
$query2 = "UPDATE incidenten SET typen='$typen',Melding='$melding', WHERE incidentID='$value'";
$result2=mysql_query($query2) or die("Query Failed : ".mysql_error());
echo "Successfully Updated";
}
?>
<p align=right><a href="view.php">VIEW RECORDS</a></p>
<p align=right><a href="index.php">HOME</a></p>
答案 0 :(得分:0)
Melding: <input name="marks" type="text" /><br />
^^^^^^
您已将输入命名为marks
,而不是Melding
。
答案 1 :(得分:0)
$ _POST中的每个索引都是一个表单字段。你缺少melding
字段。