Reputation: 123
As far as I can tell, clicking on submit button does not take me to the next page.
Here is add_product.php which is included in ./admin/index.php and this is the form I have a problem with:
<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>
and add_sql.php (from above)
<?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);
?>
can anyone see what is wrong here?
Upvotes: 0
Views: 4193
Reputation: 219794
<form type='./inc/add_sql.php'
should be:
<form action='./inc/add_sql.php'
Upvotes: 4