Please Read and HELP!

 
Post new topic   Reply to topic    Aprelium Forum Index -> FastCGI/CGI
View previous topic :: View next topic  
Author Message
sean
-


Joined: 29 Jan 2004
Posts: 18
Location: London

PostPosted: Thu Feb 12, 2004 11:34 pm    Post subject: Please Read and HELP! Reply with quote

Hey all,

I'm pretty new to this so bear with me...

How can i retrieve data from a form with CGI? For example, someone puts in the name, then press submit - how do i get the next page to say "Welcome (name)!"

Any help would be appreciated :)

Sean \m/
Back to top View user's profile Send private message Visit poster's website MSN Messenger
nquin321
-


Joined: 29 Jan 2004
Posts: 296
Location: Right Behind You

PostPosted: Fri Feb 13, 2004 1:14 am    Post subject: Reply with quote

you can do it easy with javascript

http://www.javascriptkit.com/script/cut16.shtml
Back to top View user's profile Send private message
sean
-


Joined: 29 Jan 2004
Posts: 18
Location: London

PostPosted: Fri Feb 13, 2004 5:38 pm    Post subject: Ummmm Reply with quote

Hey thanks, but i know there is a way to do it with CGI - and i'm learning CGI, so i would like to do it with that....

Thanks anyway.
Back to top View user's profile Send private message Visit poster's website MSN Messenger
aprelium
-


Joined: 22 Mar 2002
Posts: 6800

PostPosted: Sun Feb 15, 2004 4:51 pm    Post subject: Re: Please Read and HELP! Reply with quote

sean,

Here is an example in Perl. Install Perl as described in http://www.aprelium.com/abyssws/perl.html .

Save this HTML code file as hello.html:


Code:
<HTML>
  <HEAD>
    <TITLE>Hello</TITLE>
  </HEAD>
  <BODY>
    <FORM ACTION = "hello.pl" METHOD ="GET">
      What's your name: <INPUT TYPE="text" NAME="name" SIZE="20" VALUE="Enter your Name"><BR>
      <BR>
      <INPUT TYPE="submit" VALUE ="click here">
    </FORM>
  </BODY>
</HTML>


Then save this Perl code as hello.pl:

Code:

use CGI;
$query = new CGI;

# set an appropriate From: address

$yourname = $query->param('name');

print "Content-type: text/html\n\n";
print <<"EOF";
<HTML>
<HEAD>
<TITLE>Hello</TITLE>
</HEAD>

<BODY>

<P>Hello $yourname</P>

</BODY>
</HTML>
EOF
;


Put both files in your htdocs/ directory and browse http://yousite/hello.html .
_________________
Support Team
Aprelium - http://www.aprelium.com
Back to top View user's profile Send private message Send e-mail
sean
-


Joined: 29 Jan 2004
Posts: 18
Location: London

PostPosted: Mon Feb 16, 2004 6:50 pm    Post subject: Hey, thanks for that Reply with quote

Thanks for that Aprelium. It helped a lot. I also found a new way to do it, at the top of my pages i put:

require "cgi-lib.pl";

&ReadParse(*input);

$uname= $input{'name'};

and then in my document i put
print "Hello $uname";

and it works fine. :) Thank you
Back to top View user's profile Send private message Visit poster's website MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Aprelium Forum Index -> FastCGI/CGI All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB phpBB Group