Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

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:

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.,.php,.plor.cgi)enter=car
were 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.

Replies are listed 'Best First'.
Re: Passing data a from URL into a form???
by data64 (Chaplain) on Feb 28, 2002 at 02:41 UTC
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.
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: 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>

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://148114]
Approved by root
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (9)
As of 2018-06-18 21:50 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (110 votes). Check out past polls.