netspark
04-05-2001, 01:58 AM
Hi Everyone,
I'm hoping someone here can help me with a hack that I am struggling with. I have a search form in the upper left of my site at http://www.InvestorsRow.com where I would like a person to be able to enter a stock symbol and have it take them to the Forum that contains that stock symbol in the title. Currently the search feature has the ability to search thread titles, but in my situation I would like to create a hack that searches the forum titles instead of the thread titles.
I got some good advice from another thread saying that I should write my own script with the following query:
SELECT * FROM forum WHERE title LIKE '%symbol searched for%'
So I tried creating a form that calls a script to search for the forumid of the forum title that contains the stock symbol entered in the form... this is the mess that I came up with... LOL
<HTML>
<HEAD>
<TITLE>Forum Search</TITLE>
<?php
require("global.php");
$forumid=$DB_site->query("SELECT forumid,title FROM forum WHERE title LIKE '%StockSymbol%'");
?>
<SCRIPT TYPE="text/javascript">
function ForumSearch() {
window.location="http://www.InvestorsRow.com/board/forumdisplay.php?$forumid;
}
</SCRIPT>
</HEAD>
<BODY>
<FORM Name="ForumSearch">
<INPUT TYPE="text" SIZE="6" NAME="StockSymbol" VALUE="">
<INPUT TYPE="Button" VALUE="Go" NAME="Go" onClick="ForumSearch()">
</FORM>
</BODY>
</HTML>
And it doesn't even come close to working because I'm a little confused about which page to put the script, where to direct the form, and what variables to pass... I'm assuming I need a script on the same page as my form that will search and find the forum id of the forum title that contains the query string entered, and then pass that forum id to the forumdisplay.php page?
If anyone could give me some advice, I would GREATLY appreciate it!
thanks!
Mike
I'm hoping someone here can help me with a hack that I am struggling with. I have a search form in the upper left of my site at http://www.InvestorsRow.com where I would like a person to be able to enter a stock symbol and have it take them to the Forum that contains that stock symbol in the title. Currently the search feature has the ability to search thread titles, but in my situation I would like to create a hack that searches the forum titles instead of the thread titles.
I got some good advice from another thread saying that I should write my own script with the following query:
SELECT * FROM forum WHERE title LIKE '%symbol searched for%'
So I tried creating a form that calls a script to search for the forumid of the forum title that contains the stock symbol entered in the form... this is the mess that I came up with... LOL
<HTML>
<HEAD>
<TITLE>Forum Search</TITLE>
<?php
require("global.php");
$forumid=$DB_site->query("SELECT forumid,title FROM forum WHERE title LIKE '%StockSymbol%'");
?>
<SCRIPT TYPE="text/javascript">
function ForumSearch() {
window.location="http://www.InvestorsRow.com/board/forumdisplay.php?$forumid;
}
</SCRIPT>
</HEAD>
<BODY>
<FORM Name="ForumSearch">
<INPUT TYPE="text" SIZE="6" NAME="StockSymbol" VALUE="">
<INPUT TYPE="Button" VALUE="Go" NAME="Go" onClick="ForumSearch()">
</FORM>
</BODY>
</HTML>
And it doesn't even come close to working because I'm a little confused about which page to put the script, where to direct the form, and what variables to pass... I'm assuming I need a script on the same page as my form that will search and find the forum id of the forum title that contains the query string entered, and then pass that forum id to the forumdisplay.php page?
If anyone could give me some advice, I would GREATLY appreciate it!
thanks!
Mike