- 1、本文档共7页,可阅读全部内容。
- 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
PHP语句
html
head
titleBook_o_Rama Catalog Search/title
/head
body
h1Book_O_Rama Catalog Search/h1
form action=results.php method=post
Choose Search Type:br /
select name=searchtype
option value=authorAuthor/option
option value=titleTitle/option
option value=ISBNISBN/option
/select
br /
Enter Search Term:br /
input nwme=searchterm type=text
br /
input type=submit value=search
/form
/body
/html
html
head
titleBook_o_Rama Search Results/title
/head
body
h1Book_O_Rama Search Results/h1
?php
//create short variable names
$searchtype=$_POST[searchtype];
$searchterm=$_POST[searchterm];
$searchterm= trim($searchterm);
if (!$searchtype || !$searchterm)
{
echo you have not entered search details.please
go back and try again.;
}
if (!get_magic_quotes_gpc())
{
$searchtype=addslashes($searchtype);
$searchterm=addslashes($searchterm);
}
@ $db = new mysqli(localhost,bookorama,bookorama123, book_o_rama );
if (mysqli_connect_errno())
{
echo ERROR: Could not connect to database.Please try and later.;
exit;
}
$query = select * from books where .$searchtype.like %.$seachterm.% ;
$results = $db-query($query);
$num_results = $result-num_rows;
echopNumber of books found: .$num_results./p;
for($i=0;$i $num_results; $i++)
{
$row = $result-fetch_assoc();
echo pstrong.($i+1)..Title:;
echo htmlsprcialchars(stripslashes($row[title]));
echo /strongbr /Author; ;
echo scripslashes($row[author]);
echo br /ISBN: ;
echo scripslashes($row[ISBN]);
echo br /Price: ;
echo scripslashes($row[price]);
echo /p;
}
$result-free();
$db-close();
?
/body
/html
html
head
titleBook_o_Rama Book Entry Results/title
/head
body
h1Book_o_Rama Book Entry /h1
form action=insert_book.php method=post
table border=0
tr
tdISBN/td
tdinput type=text name=isbn maxlength=13 size=13/td
/tr
tr
tdAuthor/td
tdinput type=text name=author maxlength=30 size=30/td
/tr
tr
tdTitle/td
tdinput type=text name=title maxlength=60 size=30/td
/tr
tr
tdPrice $/td
tdi
文档评论(0)