English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

How do you in either php or javascript pass a varible from your website to another websites input field. ie. pass a varible from my website to the google seach bar.

2006-08-21 16:09:28 · 2 answers · asked by rfulky 1 in Computers & Internet Programming & Design

2 answers

i am more of an ASP.NET programmer, and in ASP, there are many ways of doing it depending on your requirements:

-By viewstate:
the variable you pass is sort of encrypted. if you go to gmail, you notice there is a very very long and random alphanumeric in your address bar. that is encrypted information using viewstate. viewstate variables can be accessed in any page in the application

-By session:
in ASP, if you enable session, you can create session variables that will 'stay' throughout an entire session. A session variable can be accessed by any page in an application but not viewable in an address bar in the client's browser, unlike viewstate variables. session variables are hidden server side codes. session variables are "cleared" or "terminated" when a session ended either by timeout (sessionTimeout) or by clearing it (example: abruptly closing a browser, clicking logoff button). it can be done using session.abandon()

-By QueryString:
By far the most applicable to you i think. I've done some PHP programming before and have done passing of a variable using Querystring. look at this page address bar. you will see smth like:

http://answers.yahoo.com/xxx/.... ?link=question&answer=abc.....&uid=xxxx....

a querystring format goes like this:
xxxxxx.yahoo.com?yyyy=abc&zzz=def&aaa=123

where xxx is your page address, ?yyy is the first (start) of your first variable and subsequent variables starts with '&' and the value with '='. querystring variables can only be 'seen' to the page where it is 'sent' to.

i believe in PHP, query strings are sent in the HTTP header using $_POST. here's the link about query string discussion in PHP:

http://www.thescripts.com/forum/thread2571.html

hope that helps! thank you also for bringing up this topic as i need to code now in PHP about a freelance proj

2006-08-21 16:50:15 · answer #1 · answered by Anonymous · 0 0

Google supports the "put" method so you can just put your search parameters in the URL: http://www.google.com/search?q=javascript+pass+variable&nextone=whatever etc. Just look at your address bar when you're doing a Google search and you can see the syntax.

2006-08-21 17:59:35 · answer #2 · answered by injanier 7 · 0 0

fedest.com, questions and answers