What I want to do is put links on my site that automatically fill in search text.... e.g. instead of the user typing 'tuners' in the search box an pressing enter, I want a link that says 'Search for all Tuners' and when they click it it does the search. Is there an easy way to pass text to the search function? OK, so my search form looks like this: Quote: <FORM NAME="quick_find" ACTION="index.asp?function=SEARCH" METHOD="POST"> I'm a bit of a numptie on such things, so treat me like an idiot! Thanks, RP
You should've posted this in the Javascript forum. Anyway, try this one.. <script type="text/javascript"> function quickFind(query) { document.quick_find.query.value=query; document.quick_find.submit(); } </script> <form name="quick_find" action="index.asp?function=SEARCH" method="POST"> <input type="text" name="query" /><input type="submit" value="Search" /> </form> <a href="javascript:quickFind('tuners');">Search for all Tuners</a> HTML: You didn't say what the name of the text field is so I just used "query".. but you can change that to whatever yours is. You'll have to change the one in the script as well.
Or you can do it serverside instead so it works for users who have javascript turned off.... For ASP/ ASP.Net it would simply be a case of having Request.Querystring("ID of Attribute") to pick up the value from the URL and then feed this into your normal search script
Thanks for responses - after playing around and comparing my html with others' I found that all I needed was to use links like this: http://www.marsguitars.co.uk/index.asp?function=SEARCH&search=tuner