G' day!i have my code here in searching a record..it runs very well..but i want to add an options..i want to add like this:
<select>
<option name="course">course</option>
<option name="surname">surname</option>
<option name="department">department</option>
<option name="email address">email address</option>
<option name="student no">student no</option>
</select>
i want to add that code in my program..and i know there's a revision in my code..here's my static html code:
index.php
<div><form method="post" id="newsletterform" action="search.php">
<input type="text" name="term" id="s" style="width: 95%;" />
<button class="Button" type="submit" name="search">
search.php
<?php
mysql_connect ("localhost", "root") or die (mysql_error());
mysql_select_db ("records");
$term = $_POST['term'];
$sql = mysql_query("select * from students where name like '%$term%' OR studno like '$term%'");
echo "<table width='600' cellspacing='0' cellpadding='0' border='0' align='center'>";
echo "<tr><th bgcolor='#99FFCC'>Student No:</th><th bgcolor='#99FFCC'>Name</th> <th bgcolor='#99FFCC'>Course</th> <th bgcolor='#99FFCC'>Year</th><th bgcolor='#99FFCC'>Department</th></tr>";
while ($row = mysql_fetch_assoc($sql)){
echo '<td bgcolor="ffffcc"><center>' . $row['studno'] . '</td>';
echo '<td bgcolor="ffffcc"><center>' . $row['name'] . '</td>';
echo '<td bgcolor="ffffcc"><center>' . $row['course'] . '</td>';
echo '<td bgcolor="ffffcc"><center>' . $row['year'] . '</td>';
echo '<td bgcolor="ffffcc"><center>' . $row['department'] . '</td>';
echo "</tr>";
}
echo "</table>";
?>