Solved

selecting links and passing values (perl)

Posted on 2004-04-27
2
170 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
Comment Utility
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
Comment Utility
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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

In this tutorial I will aim to show you how simple is making a small application in WhizBase, how to add, remove and update data in the DB. I will make a small address book application where you can add, browse, update and remove addresses. I wi…
Making a simple AJAX shopping cart Couple years ago I made my first shopping cart, I used iframe and JavaScript, it was very good at that time, there were no sessions or AJAX, I used cookies on clients machine. Today we have more advanced techno…
Learn the basics of lists in Python. Lists, as their name suggests, are a means for ordering and storing values. : Lists are declared using brackets; for example: t = [1, 2, 3]: Lists may contain a mix of data types; for example: t = ['string', 1, T…
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

772 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now