簡體   English   中英

HTML提交按鈕不起作用

[英]html submit button not working

據我所知,單擊“提交”按鈕不會將我帶到下一頁。

這是./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 (&pound;): <br/>
<input type='text' name='price' /><br/><br/>

Use Stock Values?<br/>
<input type='radio' name='use_stock' value='1' /> Yes &nbsp
<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);
?>

誰能看到這里有什么問題嗎?

<form type='./inc/add_sql.php'

應該:

<form action='./inc/add_sql.php'

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM