我试图让我的搜索在我的数据库中查找$ searchtext,其中$ selecteditem表示它正在搜索的columb.我在代码的最后部分得到了语法错误
我的表格 -
<form name="search" id="search" method="POST" action="">
<input type="text" name="searchterm" id="searchterm">
<select name="selectitem">
<option value="propertydescription">Property/Description</option>
<option value="transactiontype">Transaction type</option>
<option value="applicabledocument">Applicable document</option>
<option value="recieved">recieved</option>
<option value="paid">paid</option>
</select>
</div></td>
<td> </td>
<td><input type="submit" name="search" value="search"></td>
Run Code Online (Sandbox Code Playgroud)
我的php为此 -
if (isset($_POST['search']))
{
$columbname = $_POST['selectitem'];
$searchterm = $_POST['searchterm'];
$query="SELECT * FROM transactions WHERE agentclient = '$agentclient' AND WHERE '$columbname' = '$searchterm'";
$result = mysql_query ($query) or die(mysql_error());
}
else
Run Code Online (Sandbox Code Playgroud) 在这段代码中,我试图让我的变量显示在它发送的电子邮件中,由于某种原因它不是.
有什么方法可以在html中显示变量吗?不确定我做错了什么.
不显示的变量是$ applicabledocument
// Start email send notification
<titleNew submission by $agentclient</title>
</head>
<body>
<p>New submission by $agentclient</p>
<table border=\"1\">
<tr>
<th>Date</th>
<th>Property/Description</th>
<th>Transaction Type</th>
<th>Applicable Document</th>
</tr>
<tr>
<td>$date</td>
<td>$propertydescription</td>
<td>$transactiontype</td>
<td><a href=\"http:www.xxxxxx.net/xxxxxx/xxxx/\"><$applicabledocument</a></td>
</tr>
</table>
</body>
</html>
";
// Always set content-type when sending HTML email
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";
Run Code Online (Sandbox Code Playgroud)