Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

selecting links and passing values (perl)

Posted on 2004-04-27
2
Medium Priority
?
224 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 150 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

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

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

In this tutorial I will show you how to provide a dynamic RTF document on your website generated with data from your database. For this tutorial you will need Microsoft Word or WordPad, WhizBase and Microsoft Access. In this tutorial I will show …
A quick Powershell script I wrote to find old program installations and check versions of a specific file across the network.
Learn the basics of if, else, and elif statements in Python 2.7. Use "if" statements to test a specified condition.: The structure of an if statement is as follows: (CODE) Use "else" statements to allow the execution of an alternative, if the …
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…
Suggested Courses

927 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