Date: 10/15/01
- Next message: Adam Jackson: "[PHP-DB] mysql ID's"
- Previous message: Mike Patton: "RE: [PHP-DB] how to do a search in mysql database for multiple keywords??"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
I've been reading through this newsgroup and have acquired snippets of
code that I thought would work, but I am missing something in passing my
variables from the html portion to the php portion. If I hard code in
some values I get a correct search, but I need to be able to pass the
variables in.
Suggestions please.
<body>
<?
$field=array();
$keyword=array();
$keyword=array();
?>
<html>
<table border="0" cellspacing="5" cellpadding="5">
<tr>
<td valign="top"><b>Search Database on </b></td>
<td>
<form>
<input type="Text" name="keyword.php" size="25" method=GET></td>
<? $HTTP_GET_VARS["keyword"] ?>
</form>
</tr>
<tr>
<td valign="top"><b>Search</b></td>
<form method=GET>
<td><select name="field.php" size="1">
<? $HTTP_GET_VARS["field"] ?>
<!-- LOOP lines -->
<option name=field value="Chamber">Chamber</option>
<option name=field value="Date" >Date</option>
<option name=field value="Time" >Time</option>
<option name=field value="TermID" >Terminal ID</option>
<option name=field value="FLID" >Forward Link ID</option>
<option name=field value="RLID" >Return Link ID</option>
<option name=field value="HWID" >Hardware ID </option>
<option name=field value="bootVer" >Boot Version </option>
<option name=field value="hwVer" > Hardware Version </option>
<option name=field value="appVer" >Application Version </option>
<option name=field value="txSF" >Transmit SF </option>
<option name=field value="tx_olg">Transmit olg </option>
<!-- END_LOOP lines -->
</select></td>
<form>
<? $HTTP_GET_VARS["field"];
$HTTP_GET_VARS["keyword"];
?>
<td colspan="2" align="center"><input type="Submit" name="submit"
value="submit"></td> </form>
</tr>
</table>
</body>
</html>
<?php
if (isset($submit)) {
// if there is an field, then it's an update
if (isset($field)) {
reset($HTTP_POST_VARS);
$field = ""; $search_item = "";
while(list($field,$search_item) = each($HTTP_GET_VARS)) {
if (ereg("^$field\.", $keyword)) {
}
if ($set == "")
$HTTP_GET_VARS["keyword"];
$HTTP_GET_VARS["field"];
{ print "Getting Data"; exit; }
}
}
$HTTP_GET_VARS["keyword"];
$HTTP_GET_VARS["field"];
// this part works when hard coded
$dbh = mysql_connect("connect","user","password");
$result = mysql_list_tables("table");
echo "$result<br>\n";
mysql_select_db("database");
$query = "SELECT * FROM F4 WHERE field="$field" AND
keyword="%"keyword"%" limit 0, 30";
echo"$query<br>\n";
$result = mysql_query($query,$dbh);
echo "$result<br>\n";
$field = mysql_num_fields($result);
while ($row=mysql_fetch_array($result))
{
for ($i=0; $i<$field; $i++)
{
$name=mysql_field_name($result, $i);
echo "$name = $row[$name]<br> \n";
}
echo "<br><br>\n";
}
//end of part that works
?>
-- Helen Rosseau TechnologistVistar Telecommunications Inc 427 Laurier Ave W Suite 1410 Ottawa Ontario Canada K1R 7Y2 613-230-4848 ext 2245 Fax 613-230-4940 email hrosseau <email protected>
-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-db-unsubscribe <email protected> For additional commands, e-mail: php-db-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: Adam Jackson: "[PHP-DB] mysql ID's"
- Previous message: Mike Patton: "RE: [PHP-DB] how to do a search in mysql database for multiple keywords??"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

