Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hello all:

I would like to take the fields from a specific row in a flatfile db (based on a unique ID field) and insert them into the appropriate text fields on an html template.

I don't even know where to begin to look for this answer. I know I have to split and join, but when I put the variable onto the html template fields like this:

<input name="company_address_1" VALUE="$company_address_1">

I also tried like this: <input name="company_address_1" VALUE="$FORM{'$company_address_1'}">

the template displays with blank fields. Hidden fields display with the correct variable input, though...I'm lost. Can someone please help?

Replies are listed 'Best First'.
Re: Variables in form text fields from flatfile
by erikharrison (Deacon) on May 16, 2002 at 17:51 UTC

    In order to do this right, you need a complicated series of regexes. Lots of people try to write their own HTML templates, but it's harder than it looks (as you have learned - welcome to the right place!). The brunt of your solution is here on the CPAN. The next step is parsing your flatfile DB and then you should be all set.

    Cheers,
    Erik
      Thank you all for your help. I'm still lost though and I think I just didn't explain myself clearly. Here's the process.

      A customer goes to the site and fills out a form.

      Results are sent to a flatfile database (they each have a unique id).

      When they need to modify their information, they click on a link (after login) with the script.cgi?action=modify. ID is a hidden field from their login form - so it reads through the database and finds their line.

      Now the modification form displays, but it has blank fields. I want the form to display the actual value of the information from the variables in their line.

      I have tried using templates, I tried HTML::Template - nothing worked the way it was supposed to - they all come up with blank fields.

      I have seen this done on other programs, but I can't figure out how they did it. The other programs don't use HTML::Template or any special modules.

      One of the scripts I've seen that does it (FREE) is called Profile Manager.
      http://www.interlogy.com/support/download.html

      I have been trying to figure this out for over a week and my walls are about to get dented from banging my head on them. Could someone please - pretty please download this script and take a look to see what I'm missing.

      My family misses me.

      Eternally grateful and...

      eagerly waiting to feel like an idiot for not figuring it out :-)
Re: Variables in form text fields from flatfile
by blackjudas (Pilgrim) on May 16, 2002 at 17:33 UTC
    I'm not specifically sure what you're trying to do exactly, can you explain further, maybe show us some code?

    What are you using to match your data to the specific input fields? Are there going to be rows of input fields to match the data in the flatfile?

    In any case, you need to post the code you're using to accomplish your task.

    BlackJudas