Gossamer Forum
Home : General : Perl Programming :

Splitting form, joining content?

Quote Reply
Splitting form, joining content?
I have a rather complex script that reads from forms input and puts content into a |-delimited database, and then shows and build pages in various ways (yeah, just like DBMan and Links).

Now I want to split one form into two, say $title and $subtitle, but saving the result into the same string within two |'s, so that I don't have to rebuild the database, and without having to do too many changes in the script.

So, I want to change:
...
print "Title: <INPUT Name=\"title\" Size=40>\n";
...

to something like:
...
print "Title: <INPUT Name=\"toptitle\" Size=40>\n";
print "Title: <INPUT Name=\"subtitle\" Size=40>\n";

$toptitle+$subtitle=$title

... or however this is done in Perl.

Can anyone please help me with this?

Thanks
John
Quote Reply
Re: Splitting form, joining content? In reply to
Well, assuming you are using DBMan or Links (i.e. form input is stored in %in), then you could do:

$in{'FieldInDatabase'} = $in{'TopTitle'} . $in{'BottomTitle'};

before you write the line out to the database.

Without any more specifics on how the rest of the script works, that's the best I can offer. =)

Cheers,

Alex