据我所知,单击提交按钮不会将我带到下一页。
这是包含在 ./admin/index.php 中的 add_product.php,这是我遇到问题的表单:
<div class='content'>
<form type='./inc/add_sql.php' method='POST'>
Name: <br/>
<input type='text' name='name' /><br/><br/>
Discription: <br/>
<textarea rows='10' cols='32' name='discription'>
</textarea><br/><br/>
Price (£): <br/>
<input type='text' name='price' /><br/><br/>
Use Stock Values?<br/>
<input type='radio' name='use_stock' value='1' /> Yes  
<input type='radio' name='use_stock' value='0' /> No <br/><br/>
Image Text: <br/>
<input type='text' name='img_alt' /><br/><br/>
Thumbnail Text: <br/>
<input type='text' name='thumb_alt' /><br/><br/>
Stock Level (Optional)<br/>
<input type='int' name='stock' /><br/><br/>
<input type="submit" value="Submit">
</form>
</div>
和 add_sql.php (从上面)
<?php
include './sql_connect.php';
$name = mysql_real_escape_string($_POST['name']);
$discription = mysql_real_escape_string($_POST['dicription']);
$price = mysql_real_escape_string($_POST['price']);
$use_stock = mysql_real_escape_string($_POST['use_stock']);
$img_alt = mysql_real_escape_string($_POST['img_alt']);
$thumb_alt = mysql_real_escape_string($_POST['thumb_alt']);
$stock = mysql_real_escape_string($_POST['stock']);
$mysql = mysql_query("INSERT INTO `products`(`name`, `dicription`, `price`, `use_stock`, `img_alt`, `thumb_alt`, `stock`) VALUES ({$name},{$discription},{$price},{$use_stock},{$img_alt},{$thumb_alt},{$stock})");
if (!mysql_query($mysql,$con))
{
die('Error: ' . mysql_error());
}
echo "1 record added <a href='./?add_products'>continue</a>";
mysql_close($con);
?>
谁能看到这里有什么问题?