Hi,

From: "Mark Haney" <ma...@abemblem.com>
> As for the feature set I mentioned, I've been running into limitations 
> with using perl to populate dropdown boxes dynamically and such. 
> Granted, I'm sure there's a nice neat way to do it, but I couldn't find 
> anything on the interwebs to show me how, and since I know how to do it 
> in PHP, it made sense to combine the two.



I guess you may know how to do it in PHP, but wrongly, not in the right way.
As it is not recommended to mix HTML and CSS and javascript, but it is better 
to separate them in different files as much as possible, it is also not 
recommended at all to mix HTML and server side languages like PHP or others.

This is why templating systems were created.
Do you use Smarty or another templating system with PHP?
If you don't do it, it is recommended to do it.

And if you do it, you can do the same thing in Perl - use a templating system 
like Template-Toolkit.

If you should just do a dirty and fast job with no care for maintenance and 
don't want to use a form processor or a templating system, but just very low 
level programming, you can do the same wrong way in Perl as you can do in PHP.

You can just print HTML content using something like:

print <<END_OF_HTML;
<form ...>
<input ... value="$value">
<select ...>
END_OF_HTML

for my $option ( @options ) {
    print "<option value="$option">$option</option>\n";
}

print <<END;
</select>
<input type="submit">
</form>
END

You can do it, but as I said, it is harder to maintain and ugly.

Octavian


--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to