据我所知,点击提交按钮不会将我带到下一页。
这是add_product.php,它包含在./admin/index.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);
?>
有谁能看到这里有什么问题?
答案 0 :(得分:4)
<form type='./inc/add_sql.php'
应该是:
<form action='./inc/add_sql.php'