Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Substitution

Status
Not open for further replies.

mooniron

Programmer
Joined
Dec 15, 2002
Messages
26
Location
TR
I have small problem. I want to show a link contains a query string parameter which has two separate strings like
$myName = "my name";
$myLastName= "lastname";
When I want to built the link like:
&quot;<a href = mylink.pl?name=&quot;.$myName.&quot;lastname=&quot;.$myLastName.&quot;>&quot;; ...
Browser ignores everything after &quot;my&quot; and link appears as
-> mylink.pl?name=my
How can I solve this?
Thanks..
 
it's the space that's causing your problem.
You could replace the space with '%20' as that's what a space would be encoded as by a webserver

I'd really start looking at CGI.pm

HTH
--Paul
 
this will do the job

#!/usr/bin/perl -w

print &quot;Content-type: text/html\n\n&quot;;

$myName = &quot;my name&quot;;
$myLastName = &quot;lastname&quot;;

[red]$myName =~ tr/ /+/;[/red]

$url = &quot;<a href=mylink.pl?name=${myName}&lastname=${myLastName}>link text...</a>&quot;;

print &quot;$url\n&quot;;


Cheers
Duncan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top