Training, Open Source computer languages
PerlPHPPythonMySQLApache / TomcatTclRubyJavaC and C++LinuxCSS 
Search for:
Home Accessibility Courses Diary The Mouth Forum Resources Site Map About Us Contact
For 2023 - we are now fully retired from IT training.
We have made many, many friends over 25 years of teaching about Python, Tcl, Perl, PHP, Lua, Java, C and C++ - and MySQL, Linux and Solaris/SunOS too. Our training notes are now very much out of date, but due to upward compatability most of our examples remain operational and even relevant ad you are welcome to make us if them "as seen" and at your own risk.

Lisa and I (Graham) now live in what was our training centre in Melksham - happy to meet with former delegates here - but do check ahead before coming round. We are far from inactive - rather, enjoying the times that we are retired but still healthy enough in mind and body to be active!

I am also active in many other area and still look after a lot of web sites - you can find an index ((here))
get input onchange into link

Posted by cyrene (cyrene), 14 December 2004
I have some links such as web,images and Sound file and an input text with default value(query). When no changes in input text and user click on any link,it will go to search the qurey according to the link.

But the problem is when there is changes in input text and user click on the link.It keep to search the old query according to link.

I wish it able to detect and search new query.

Here my code:

<script LANGUAGE="JavaScript">
function setquery(newquery) {
   var query = newquery;

print qq(<a href="/cgi-bin/result.cgi?cat=1&query=$query">WEB</a>  
                 <a href="/cgi-bin/result.cgi?cat=2&query=$query">IMAGES</a>  
                 <a href="/cgi-bin/result.cgi?cat=3&query=$query">SOUND FILE</a>              
                 <form name="form_search" method="post" action="/cgi-bin/result.cgi">
                     <div align="center">
                                     <input type="text" name="query" value="$query" size="30" onchange="setquery(this.value)">
                     <input type="submit" name="submit" value="Web Search" style="background-color:  #FFFAFA;">
                       <a href="/adsearch.html" class="one"><font size="-1">advanced web
                     <input type="hidden" name="cat " value=1>
                     </form>);                                                }

How Perl can get the changes in input text and  assign it into link when user click on it?

Posted by Custard (Custard), 14 December 2004

Not entirely sure I understand what you mean,


wouldn't this...

      <input type="hidden" name="cat " value=1>

point all queries to the same 'cat' ?
(and theres some spaces in there that may be a bad thing)

And, do you need setquery() at all?

I am confused, could you describe your problem some more.



Posted by cyrene (cyrene), 16 December 2004
i solve this problem by having some new link for old query and input text only for new query.

This page is a thread posted to the opentalk forum at and archived here for reference. To jump to the archive index please follow this link.

You can Add a comment or ranking to this page

© WELL HOUSE CONSULTANTS LTD., 2023: Well House Manor • 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • FAX: 01144 1225 793803 • EMAIL: • WEB: • SKYPE: wellho