Notice: Undefined index: id in C:\xampp\htdocs\money\test2.php on line 14
test1.php如下:<body><formaction="test2.php"method="post"><?phpinclude'conn.php';$result...
test1.php如下:
<body>
<form action="test2.php" method="post">
<?php
include'conn.php';
$result = mysql_query("SELECT * FROM category_class1");
echo "<select name=\"mon1\">";
while($row = mysql_fetch_array($result))
{
echo "<option value=".$row['id'].">";
echo $row['content'];
echo "</option>";
}
echo "</select>";
?>
<input type="submit" />
</form>
</body>
test2.php如下:
<?php
include 'conn.php';
$sql="INSERT INTO category_class2(id_class1) VALUES('$_POST[id]')";
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
?> 展开
<body>
<form action="test2.php" method="post">
<?php
include'conn.php';
$result = mysql_query("SELECT * FROM category_class1");
echo "<select name=\"mon1\">";
while($row = mysql_fetch_array($result))
{
echo "<option value=".$row['id'].">";
echo $row['content'];
echo "</option>";
}
echo "</select>";
?>
<input type="submit" />
</form>
</body>
test2.php如下:
<?php
include 'conn.php';
$sql="INSERT INTO category_class2(id_class1) VALUES('$_POST[id]')";
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
?> 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询