vijayayarra has asked for the wisdom of the Perl Monks concerning the following question:

Dear all,

Thank you for given reply. Actually what my problem here is. I have to extract the data from database and which has to be assigned to one of the text field based on the given input value.

say per example

<input type="text" name="len"> $query="select gc from gene where length=len"; $qy=$e->prepare($query); $qy->execute(); $res=$qy->fetchrow; <input type="text" name="gc" value=$res>
something like above , given input value is len but directly I can use text field name in the sql query ofcourse by using javascript
var len=document.len.value
len variable have the text field value but that also is not compatible with perl.

What should I do? please tell me the way.

Replies are listed 'Best First'.
Re: How to pass html text field value to perl variable
by CountZero (Bishop) on Feb 24, 2009 at 10:49 UTC
    May we assume that your HTML text field is part of a HTML form? If so the form will have an action attribute which will link to an URI, most probably a script on your server which will receive the form's elements. CGI will allow you to get these values easily.

    CountZero

    A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

Re: How to pass html text field value to perl variable
by moritz (Cardinal) on Feb 24, 2009 at 08:52 UTC
    HTML doesn't support Perl variables, so you can't do that.

    You can either user Javascript to achieve something similar, or tell us what you actually want to achieve in the end, maybe there's a better solution.