By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,659 Members | 910 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,659 IT Pros & Developers. It's quick & easy.

pass a perl variable to html

P: 9
I am using a perl script to produce a six element array. When I click a string in the first element, I am linked to a html table (all.html) and the matching string is displayed in the first row of the html table.

This is the variable I am using in the perl script:

$ewstring= substr($string[$count - 1],3);

and this is the link to the html table (all.html):

$thisrow = $thisrow . "<td>" . $myfont . "<a href=/Operations/all.html#$ewstring style=text-decoration:none><font color=#000000>" . substr($string[$count - 1],3) . "</a>";

If I could have highlighted that matched value in the html table I would have done so, but I don't think that can be done in html. I was wondering if I could print that variable string outside the html table so that a user would see what string they selected.

Thanks.
Jul 13 '07 #1
Share this Question
Share on Google+
8 Replies


KevinADC
Expert 2.5K+
P: 4,059
I am totally confused, could just be me, it's been a long week, but I have no idea what you are asking or trying to do.
Jul 13 '07 #2

P: 9
Sorry for the confusion. I would like to pass a perl variable to a html table. In the example I included in my post, $ewstring (in my perl script) is the variable that stored the string that I would like to pass to the html table. Is that a little clearer?

Thanks.
Jul 16 '07 #3

KevinADC
Expert 2.5K+
P: 4,059
If your perl script is generating and outputting the HTML code all you need do is insert your scalar into the HTML output:


Expand|Select|Wrap|Line Numbers
  1. my $foo = 'Hello World';
  2. print qq~<table><tr><td>$foo</td></tr></table>~; 
Jul 16 '07 #4

P: 9
Thanks but I am still confused. If I may I will try to explain further.
These two lines in my perl script:

$ewstring = substr($string[$count - 1],3);
$thisrow = $thisrow . "<td>" . $myfont . "<a href=/Operations/all.html#$ewstring style=text-decoration:none><font color=#000000>" . substr($string[$count - 1],3) . "</a>";

produce the following table:

01TTERRORS_TCP_from_MIS Up Up 51 Jul 16 10:04:45 0
01TTERRORS_from_PHARM Up Up 0 Jul 16 08:01:37 0
01TTLABORDERADT_TCP_from_MIS Up Up 2326 Jul 16 14:14:05 0
01TTMSGS_eater Up - 51 Jul 16 10:04:45 0

When I click on say "01TTLABORDERADT_TCP_from_MIS" from the above table, then the following html table is displayed:

Dept Error Coverage Contact Notes
01TT-eater External: 01TTMSGS_eater 0900-1700 x 5 See DC.OPS.DOC@INTFACE
01TT-MIS External: 01TTERRORS_TCP_from_MIS 24 x 7 Tech Support on-call
External: 01TTLABORDERADT_TCP_from_MIS 24 x 7 Tech Support on-call
External: 01TTRESULTS_TCP_to_MIS 24 x 7 Tech Support on-call

I would like to print the string "01TTLABORDERADT_TCP_from_MIS" at the top of the html table i.e. above the column headings. Example:

01TTLABORDERADT_TCP_from_MIS
Dept Error Coverage Contact Notes
01TT-eater External: 01TTMSGS_eater 0900-1700 x 5 See DC.OPS.DOC@INTFACE
01TT-MIS External: 01TTERRORS_TCP_from_MIS 24 x 7 Tech Support on-call
External: 01TTLABORDERADT_TCP_from_MIS 24 x 7 Tech Support on-call
External: 01TTRESULTS_TCP_to_MIS 24 x 7 Tech Support on-call

Is this more confusing?

Thanks.
Jul 16 '07 #5

KevinADC
Expert 2.5K+
P: 4,059
You seem to be quite confused. What are you expecting this to do?

<a href=/Operations/all.html#$ewstring

thaat just looks like an internal anchor that jumps to a certain part of the existing html page. It can't do anything besides that.
Jul 16 '07 #6

P: 9
Exactly. That is all I want it to do, nothing else. However, I would like to print $ewstring on top of the existing html page, if that's possible.....Perhaps it's not.
Jul 17 '07 #7

KevinADC
Expert 2.5K+
P: 4,059
It is possible but you would have to send the data back to the server, parse it, and reprint the page on the fly. Another possibility is to incorporate some DHTML/javascript into the html code that will handle the printing of the table name. But then you have the task of learnng DHTML/javascript and how to get it into your html output or asking on a DHTML/avascript forum (my javascript experience is very limited). A third possibility is AJAX, something I know next to nothing about.
Jul 17 '07 #8

P: 9
Thanks for you help. I thought this would be a whole lot more than I can handle. But I needed confirmation.

Thanks again....
Jul 18 '07 #9

Post your reply

Sign in to post your reply or Sign up for a free account.