Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: text cut at blanks

by tenatious (Beadle)
on Aug 25, 2000 at 05:15 UTC ( #29569=note: print w/replies, xml ) Need Help??


in reply to text cut at blanks

The problem is that to make valid html attributes, you need to have quotes around the attribute values. Although most modern browsers will let you get away with not quoting attribute values without a space, the html is not valid. If there is a space in the attribute value, usually browsers, will treat that as the beginning of another attribute.

e.g. Your script says:

print "<input name='anyname' value=abc def>";

the browser sees

<input name='anyname' value=abc (and some other attribute, def, that I don't recognize and which does not have a value, so I'll ignore it)>
Experiment with various ways of quoting. I use qq(); for all of my html, except when I use the CGI.pm. e.g.
$v = "abc def"; # $v only contains abc def not "abc def" $html = qq(<input name="anyname" value="$v">);

or...

$v = qq("abc def"); # $v now contains <i>"abc def"</i> $html = "<input name=\"anyname\" value=$v"; # you could also do it like this: $c = qq("abc def"); $html = qq(<input name="anyname" value=$c>);

I leave it to you to discover which is easiest for you. Alternately, you could use the CGI.pm module and let it print the stuff for you.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://29569]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (4)
As of 2022-09-27 16:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I prefer my indexes to start at:




    Results (122 votes). Check out past polls.

    Notices?