这对你们中的许多人来说可能真的很容易,但我被困在这里。我有两个文件 frame1.php 和 frame.php。frame1.php 的代码是
<?php
include "localhost.php";
if(isset($_POST['button']))
{
$query = $_POST['class'];
$raw_results = mysql_query("SELECT * FROM books
WHERE class = '$query'") or die(mysql_error());
echo 'Class:-'."".$query;
?>
<table width="500" border="1">
<tr>
<td width="96" align="center">Name</td>
<td width="107" align="center">Class:-</td>
<td width="109" align="center">Price:-</td>
<td width="43" align="center">Quantity:-</td>
<td width="112" align="center">Select quantity</td>
<td width="112" align="center">Total amount</td>
<td width="112" align="center">Add:-</td>
</tr>
<?php
if(mysql_num_rows($raw_results) > 0)
{
while($results = mysql_fetch_array($raw_results))
{
?>
<tr><td align="center"><input name="items" type="text" disabled="disabled" id="itm" value="<?php echo $results['items'];?>" /> </td>
<td align="center"><input name="class" type="text" disabled="disabled" id="cls" value="<?php echo $results['class'];?>" /></td>
<td align="center"><input name="price" type="text" disabled="disabled" id="prc" value="<?php echo $results['price'];?>" /></td>
<td align="center"><input name="quantity" type="text" disabled="disabled" id="quan" value="<?php echo $results['quantity'];?>" /></td>
<td align="center"><select name="select_quantity" onchange="getquant(this.value);"><option>Select quantity</option>
<?php for ($i=1;$i<=$results['quantity'];$i++)
{
echo '<option>'. htmlspecialchars($i) . "</option>\n";
}
?></select></td>
<td align="center"><input name="total" type="text" value="" id="total" disabled="disabled" /><br /></td>
<td align="center"><a target="frame3" href="frame3.php?var=<?php echo $results['items'];?>">Add</a></td>
</tr>
<?php
}
}
else
{
echo "There is no record.";
}
}
?>
<?php
?>
</table>
frame3.php 的代码是
<?php
$name=$_GET['var'];
include "localhost.php";
$sql="insert into temp_data(items,class,category,price,date,quantity,select_quantity,total) values('$_POST[items]','$_POST[class]','$_POST[category]','$_POST[price]','$date','$_POST[quantity]','$_POST[select_quantity]','$_POST[total]') where items=$name ";
mysql_query($sql);
$query1="select * from temp_data";
$results=mysql_query($query1);
?>
现在我正在尝试将从 frame1.php 中的文本框接收到的值输入到数据库 temp_data 中,但我在 frame3.php 中收到未定义索引的错误。可能有什么问题??????