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
Python, Lua and Tcl - public course schedule [here]
Private courses on your site - see [here]
Please ask about maintenance training for Perl, PHP, Java, C, C++, Ruby, MySQL and Linux / Tomcat systems

Posted by muroo_08 (muroo_08), 16 July 2007
i have a problem to pass username login to the 3rd page after :
this is the part of the script (to read
foreach $pair (@pairs)
   ($name, $value) = split(/=/, $pair);
   $value =~ tr/+/ /;
   $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;  
   $value =~ s/~!/ ~!/g;

   $FORM{$name} = $value;
   if ($value =~ /\<\!--\#(.*)\s+(.*)\s?=\s?(.*)--\>/) { &kill_input; }
   if ($value =~ /[;><\*`\|]/) { &kill_input; }

open (FN,"checking.cfg");
@usercheck= <FN>;
close FN;
chomp (@usercheck);

foreach (@usercheck) {
 if ($_ !~ /^#|^ |^\;/ ) {
    ($username,$password) = split (",",$_);
    chomp ($username);
    chomp ($password);
    if ($FORM{'username'} eq $username && $FORM{'password'} eq $password) {
      if ($username eq "Admin") {
print "<FRAMESET ROWS=31%,*>\n";
   print "<FRAMESET COLS=55%,*>\n";
   print "<FRAME NAME=leftpage >\n";
   print "<FRAME NAME=righpage SRC >\n";
   print "</FRAMESET>\n";    
   print "<FRAME NAME=OUTPUT>\n";  
print "</FRAMESET>\n";

and the third page, i want to use the username for , the page contain TABLE with VALUE is the username, but when i try, the VALUE IS BLANK

? thanks, hope u reply (sorry for bad english) ?

Posted by admin (Graham Ellis), 16 July 2007
Your English is a lot better than my Indonesian  

Web pages / the common gateway interface that you're using are "stateless" - in other words, each request (i.e. page or frame) stands on its own WITHOUT having the data from the previous request available to it.  It starts afresh if you like to think of it that way.

In order to pass data from one page to another, you need to "maintain state". The most common way to do this on larger applications is to use cookies, but you can also use hidden fields on a form or add extra information on to the end of a a URL.   Each of these is a big subject; there's further reading / examples here on our website and a very great deal of information elsewhere too - for example here in the Web Developers Library.

Passing just a single, simple parameter can be much easier - if you replace
print "<FRAME NAME=leftpage >\n";
print "<FRAME NAME=leftpage$FORM{username} >\n";
then you'll be able to collect your user name in your script that generates your left hand frame.

Posted by muroo_08 (muroo_08), 16 July 2007
hi graham, i'm sorry before because i'm still beginner with this.
about ?username=$FORM{username},
then to the, i write  $username but still doesn't work, and why you use
?username=$FORM{username}  not

Posted by admin (Graham Ellis), 16 July 2007
The single quotes are optional - it will work with them and it will work without them.

There's no $ on the "username" because you want the literal text 'username' to be a part of the URL at this point - you're saying to the next page that the username parameter has the value that's in the hash called %FORM.

Posted by muroo_08 (muroo_08), 16 July 2007
sorry bother again, i have tried use:
<FRAME NAME=leftpage$FORM{username} >, and the third page the part script like this :

print "Content-type: text/html\n\n";
my...   #edited
my...   #edited
my...   #edited

print "$username\n";
print <<'EOF';

i mean maybe i miss some script or something? like use .pm file

Posted by admin (Graham Ellis), 16 July 2007
You need to pick up the parameter from the form on the the third page in the same way that you pick it up on the main page.   It doesn't automatically appear in a $username variable.

Posted by KevinAD (KevinAD), 18 July 2007

have you figure out how to do what you want to do?

i mean maybe i miss some script or something? like use .pm file

You should be using the module to get the form data into your scripts. The method you are usng for parsing the form data will work but is generally considered bad practice.

Posted by muroo_08 (muroo_08), 19 July 2007
yea, you are right KevinAD, i have tried and that's work well, event i need some references, but thank you vary much for all your help Graham and you Kevin

Posted by KevinAD (KevinAD), 19 July 2007
very good, you're welcome.  

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., 2018: Well House Manor • 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01225 708225 • FAX: 01225 793803 • EMAIL: • WEB: • SKYPE: wellho