我正在尝试将 sql 数据库中的表中的代码添加到 div 中,具体取决于下拉框的结果并且它不起作用!有什么帮助吗?
index.php
<p> Choose Subject Area </p>
<form action="">
<select name="business area">
<option value="">Programming</option>
<option value="NAME">Web Design</option>
<option value="NAME">TV&Film</option>
</select>
</form>
<button id="Search" type="button">Search</button>
<?php
脚本.js
$(document).ready(function(){
$('#Search').click(function(){
$('#Results').append(
<?php
// generate sql query
$sql = "SELECT * FROM Form WHERE Company_area="business_area";
// execute query
$result=sqlite_query($db,$sql);
// get number of records found
$numrows = sqlite_num_rows($result);
echo "Number of records found: $numrows <br /><br />";
//show results on screen
while ($row = sqlite_fetch_array($result)) {
"<div>"
echo "Company Name: " . $row['Company_Name'] . "<br />";
echo "Company Area: " . $row['Company_area'] . "<br />";
echo "Description: " . $row['Description'] . "<br />";
echo "YouTube Link: " . $row['YouTube_Link'] . "<br />";
echo "Contact Name: " . $row['Contact_Name'] . "<br />";
echo "e-mail: " . $row['e-mail'] . "<br />";
echo "Facebook: " . $row['Facebook'] . "<br />";
echo "Twitter: " . $row['Twitter'] . "<br />";
echo "Website Address: " . $row['Website_address'] . "<br /><hr />";
"</div>"
}
?>
);
});
});