【php开源代码栏目提醒】:网学会员为广大网友收集整理了,getAddBook.php,希望对大家有所帮助!
<?php
header('Content-type: text/html;chareset:GB2312');
$name=$_POST['name'];
$author=$_POST['author'];
$publisher=$_POST['publisher'];
$isbn=$_POST['isbn'];
$type=$_POST['type'];
$price=$_POST['price'];
$name=iconv( 'UTF-8', 'gb2312//IGNORE' , $name);
$author=iconv( 'UTF-8', 'gb2312//IGNORE' , $author);
$publisher=iconv( 'UTF-8', 'gb2312//IGNORE' , $publisher);
$isbn=iconv( 'UTF-8', 'gb2312//IGNORE' , $isbn);
$type=iconv( 'UTF-8', 'gb2312//IGNORE' , $type);
$price=iconv( 'UTF-8', 'gb2312//IGNORE' , $price);
$link=mysql_connect("localhost","root","0");
//mysql_query("set names 'GB2312'");
mysql_select_db("books");
$exec="insert into mybook (name,author,publisher,isbn,type,price) values ('".$name."','".$author."','".$publisher."','".$isbn."','".$type."','".$price."')";
$result=my
sql_query($exec);
if($result){
echo "1";
}
mysql_close();
?>