Forum Moderators: open

Message Too Old, No Replies

SEARCH URL QUERY OR placeholder?

SEARCH URL QUERY OR placeholder

         

jasper77

11:32 pm on Jul 28, 2004 (gmt 0)

10+ Year Member



Right I don't know which name to give to my question but you will understand me and I hope help me.

Because my (cgi page) don't have the option to keep the search query in the search result template page I need your help.

Here is an example with AutoTrader.co.uk
When you click this link you go to the result page which keep the search query - in this link we search for - ALFA ROMEO 145 BETWEEN 1000 AND 5000 AND POST CODE IS w13 0np
[atsearch.autotrader.co.uk...]

########################################

For now I can do it using javascript like here:
[bodytouch.co.uk...]

with text field - as you can see the result template parse the word "Sydney" in the search box.

I REALLY NEED YOUR HELP GUYS, I WANT TO FIND A WAY TO DO THE FIRST EXAMPLE - WITH NOT ONLY TEXT FIELD BUT - DROPDOWN, CHECKBOX...ETC.

Thanks a lot.

RonPK

6:59 am on Jul 29, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hello there, jasper77,

The pages you mention both use server side techniques to parse the query string. You mention using cgi;
why don't you use a cgi script to do what you want?

Keep in mind that not everybody has javascript enabled, so you may
loose customers if you rely on that technique.

jasper77

12:57 pm on Jul 29, 2004 (gmt 0)

10+ Year Member



I can't find cgi script for that...

I think that eceryone have javascript enable or I'm wrong?

Can you recomend some cgi script?

Thanks

StupidScript

11:31 pm on Jul 29, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You could do a split() function to grab stuff out of the query string:

[domain.com...]

<script_on_search.html>
//Put the URI into a JS variable
thisuri=top.location.href;
//Split the URI to create a two-index array (0,1)
keywd=thisuri.split("keyword=");
//Grab the value of the keyword parameter
keyword_value=keywd[1];
</script>

This puts the keyword value into the keyword_value variable for use in text form elements and/or to print on screen. To manipulate drop-down form elements, the value you need is the index of the element within the drop-down array.

If you are using a longer URI, you may need more split()s:

[domain.com...]

Needs a script similar to:

<script_on_search.html>
//Put the URI into a JS variable
thisuri=top.location.href;
//Split the URI to create a two-index array (0,1)
keywdA=thisuri.split("keyword=");
//Split the second index to get the keyword
keywd=keywdA[1].split("&");
//Grab the value of the keyword parameter
keyword_value=keywd[0];
</script>

In the second example, the array index you want is now the FIRST index in the SECOND array, instead of being the SECOND index in the FIRST array...which it is in the first example.

BTW: You definitely can NOT count on users having Javascript enabled. The same approach could be used with server-side scripting (PHP, ASP, etc.), however it is much more simple, because you just grab the value of the attribute directly instead of needing to split the URI string.

jasper77

4:19 pm on Jul 30, 2004 (gmt 0)

10+ Year Member



Thank you I will see what I can do....

jasper77

12:14 am on Aug 1, 2004 (gmt 0)

10+ Year Member



Thanks for your help, I probably will hire some programmer and pay him money to do this for me.

About "Javascript enabled" the secont language I just can't see people who don't have it how they can look at the web sites - when every website - every page have javascript inside.

For example they can't see a site like "Ebay" because they don't have javascript enabled browser?