Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Passing data a from URL into a form???

by Anonymous Monk
on Feb 28, 2002 at 02:26 UTC ( #148114=perlquestion: print w/ replies, xml ) Need Help??
Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

HELP!!!
-------
Sorry to yell but I need some help asap.
I have a form that when submitted logs data into a db however I need to add data from the page url into the form i.e.
http://mysite.com/form.(html,.php,.plor.cgi)enter=car
were http://mysite.com/form.html is the page were the form in on.
and 'enter' is the field in the form were the data needs to go.
and 'car' is the data that is to be add into the form.
Thanks for any help you can give.
Casper

Comment on Passing data a from URL into a form???
Re: Passing data a from URL into a form???
by data64 (Chaplain) on Feb 28, 2002 at 02:41 UTC
Re: I need some help asp.
by justinNEE (Monk) on Feb 28, 2002 at 03:21 UTC
    I might be misunderstanding the question but I think you are saying you have 'form.cgi?enter=car' that has an html form on it that submits to another file (form2.cgi) But you want enter=car to go in the database as well, is that right? Just put db code into form.cgi as well. If you really want to submit it to the database in form2.cgi, here is one way to do it: put it into a hidden field in form.cgi. It might sound like its a bad idea, but really its a horrible idea. form.cgi:
    <FORM> <INPUT NAME="newField1"> <INPUT NAME="newFIeld2"> <INPUT NAME="enter" VALUE="car"> <INPUT TYPE=SUBMIT> </FORM>
Re: Passing data a from URL into a form???
by screamingeagle (Curate) on Feb 28, 2002 at 03:55 UTC
    if what u need to know is how to prepolulate a form with data which is being passed to it , use the CGI module's param method; to use your example
    #!/usr/bin/perl use strict; use CGI qw(cgi); my $cgi = new CGI; print "<html><body><form>\n<input type=text name=car value=" . $cgi->p +aram('enter'); . "></form></body>"
    this will display the value of the 'enter' parameter (i.e. car) in the html form hth...
Re: Passing data a from URL into a form???
by funky_aunt (Acolyte) on Feb 28, 2002 at 04:29 UTC
    I highly recommend Ovid's CGI tutorial. He gives an example similar to this.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://148114]
Approved by root
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (5)
As of 2014-09-20 00:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (151 votes), past polls