Solved

selecting links and passing values (perl)

Posted on 2004-04-27
2
199 Views
Last Modified: 2013-12-25
using perl
my main page has a table with the numbers 1-52 (each one representing a week in 1 year)

selecting a number will determine what week i want to view data for.
(each number in the table is a link to the next page.....all numbers have  the same link as the next page process' the data)

i also have another directory that has 52 file, each file contains data for that certain week.

how do get it to select a week from my main page and it will pass the filename relating to that week to the next page.

currently my second page reads a file that contains data for the current week. i want it to be passed the week selected from the previous page so that it will read the file with the data relating to that week.

i have repeated myself here a few times...hope you undterstand what i am looking for!
0
Comment
Question by:plennon
2 Comments
 

Author Comment

by:plennon
ID: 10929376
update:

here's want i want to happen

i want to select a link and when i select it a certain number will be written to a file. That number can then be read by any number of pages that needs it.

i need to know how to write to file after a link has been selected and before the linked page loads up

hope this helps
0
 
LVL 18

Accepted Solution

by:
kandura earned 50 total points
ID: 10943325
Writing that value to a file doesn't sound like a great idea. What would happen if two people visit this page, and each of them selects a different week?

Anyway, the general way to pass values between scripts is by using parameters, either in a form, or in a url.
A url such as
/cgi-bin/script.pl?var_a=value_a
would pass the parameter var_a to the script, with value value_a.

Your script would obtain this parameter by using the CGI module:

#!/usr/bin/perl
use strict;
use warnings;
use CGI;
$|++;

my $cgi = new CGI;
my $var_a = $cgi->param('var_a');
### $var_a now contains the value_a
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

If you get a (Blue Screen of Death), your system writes a small file called a minidump. Your first step is to make certain your computer is setup to record memory dumps. Right click My Computer, choose properties. Click on the advanced tab, an…
This tutorial will discuss the log-in process using WhizBase. In this article I assume you already know HTML. I will write the code using WhizBase Server Pages, so you need to know some basics in WBSP (you might look at some of my other articles abo…
Learn the basics of modules and packages in Python. Every Python file is a module, ending in the suffix: .py: Modules are a collection of functions and variables.: Packages are a collection of modules.: Module functions and variables are accessed us…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…

837 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question