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
 
For 2023 (and 2024 ...) - we are now fully retired from IT training.
We have made many, many friends over 25 years of teaching about Python, Tcl, Perl, PHP, Lua, Java, C and C++ - and MySQL, Linux and Solaris/SunOS too. Our training notes are now very much out of date, but due to upward compatability most of our examples remain operational and even relevant ad you are welcome to make us if them "as seen" and at your own risk.

Lisa and I (Graham) now live in what was our training centre in Melksham - happy to meet with former delegates here - but do check ahead before coming round. We are far from inactive - rather, enjoying the times that we are retired but still healthy enough in mind and body to be active!

I am also active in many other area and still look after a lot of web sites - you can find an index ((here))
send a variable from perl to html

Posted by roop (roop), 10 July 2007
I have been struggling with this for a while.  Any help would be appreciated.  Here's the perl snippet that links to the html:

       $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>";

The variable $ewstring is created with names found in "all.html".  I would like to pass the value in $ewstring and display it at the top of "all.html".


Posted by admin (Graham Ellis), 11 July 2007
You'll need to pass in the parameter in the form

?myval=$ewstring

rather that

#$ewstring

And then have the all.html URL point to a Perl (or PHP or something) script to do the substitution.   Personally I would go for PHP if it's on your server, as all you would need to do within the HTML is put in something like:

<?php print ($_REQUEST[myval]); >?

That's just a brief intro to the technique needed - you'll need to consider all the various security concerns if $ewstring can contain certain special characters, and to set up your web server to parse the all.html file as .php.

Posted by roop (roop), 11 July 2007
Graham,

Thanks for the reply.  But I thought all perl variables had to start with "$" and not "?".  Or am I missing the obvious?  BTW, I am a newbie at perl and html.

Thanks.

Posted by admin (Graham Ellis), 11 July 2007
The "?" is the separator between a web page name and the parameters passed into that page as if a form had been filled in - that's the way to send variable data into the next page.  Basically, you're saying "I want a variable called myval in th enext page and it will contain what the $ewstring variable conatins on the curent page"

Posted by roop (roop), 11 July 2007
Thanks....



This page is a thread posted to the opentalk forum at www.opentalk.org.uk 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., 2024: Well House Manor • 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • FAX: 01144 1225 793803 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho