Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Saving html form into oracle database

Reply
Thread Tools

Saving html form into oracle database

 
 
Nick
Guest
Posts: n/a
 
      10-01-2003
I'm new to perl programming. Just wanted to know if there is a way I
could save the whole HTML FORM into database rather then saving it by
individual fields.
Someone mentioned it to me that it can be done. I just don't know how
to do it.

Reason I'm trying to do this is because im working on a FORM with
about 50 input fields. All I need is a way to save this form and pull
it back with the data and be able to make changes to it and save it
again. I know I can run a sql query and save all the fields
individually and do the same when I put the data back into the FORM
before showing it but thats kinda lengthy approach. Anyone know a
better way of doing this?? Don't know much about cgi.pm either.

Thanks for your help.
Nick
 
Reply With Quote
 
 
 
 
Michael Budash
Guest
Posts: n/a
 
      10-01-2003
In article <(E-Mail Removed) >,
http://www.velocityreviews.com/forums/(E-Mail Removed) (Nick) wrote:

> I'm new to perl programming. Just wanted to know if there is a way I
> could save the whole HTML FORM into database rather then saving it by
> individual fields.
> Someone mentioned it to me that it can be done. I just don't know how
> to do it.
>
> Reason I'm trying to do this is because im working on a FORM with
> about 50 input fields. All I need is a way to save this form and pull
> it back with the data and be able to make changes to it and save it
> again. I know I can run a sql query and save all the fields
> individually and do the same when I put the data back into the FORM
> before showing it but thats kinda lengthy approach. Anyone know a
> better way of doing this?? Don't know much about cgi.pm either.
>
> Thanks for your help.
> Nick


the problem i see is that a cgi script is not delivered a form, it's
delivered the names/values _in_ a form when that form was submitted. one
possibility: have your form handler read in the static html file
containing the form, fill it in, and save it to your db in a blob field
(ugh!)

hth-

--
Michael Budash
 
Reply With Quote
 
 
 
 
Eric Schwartz
Guest
Posts: n/a
 
      10-01-2003
Michael Budash <(E-Mail Removed)> writes:
> In article <(E-Mail Removed) >,
> (E-Mail Removed) (Nick) wrote:
>> I'm new to perl programming. Just wanted to know if there is a way I
>> could save the whole HTML FORM into database rather then saving it by
>> individual fields.
>> Someone mentioned it to me that it can be done. I just don't know how
>> to do it.


One approach is to save off the form parameters into a hash, and stuff
the hash into a BLOB with Data:umper or Storable or some such module.

> the problem i see is that a cgi script is not delivered a form, it's
> delivered the names/values _in_ a form when that form was submitted. one
> possibility: have your form handler read in the static html file
> containing the form, fill it in, and save it to your db in a blob field
> (ugh!)


Ick. Just save the form parameters and values, and use CGI.pm to
re-create the form along with the values you loaded from the
database. Why make things so needlessly complicated?

-=Eric
--
Come to think of it, there are already a million monkeys on a million
typewriters, and Usenet is NOTHING like Shakespeare.
-- Blair Houghton.
 
Reply With Quote
 
Michael Budash
Guest
Posts: n/a
 
      10-01-2003
In article <(E-Mail Removed)>,
Eric Schwartz <(E-Mail Removed)> wrote:

> Michael Budash <(E-Mail Removed)> writes:
> > In article <(E-Mail Removed) >,
> > (E-Mail Removed) (Nick) wrote:
> >> I'm new to perl programming. Just wanted to know if there is a way I
> >> could save the whole HTML FORM into database rather then saving it by
> >> individual fields.
> >> Someone mentioned it to me that it can be done. I just don't know how
> >> to do it.

>
> One approach is to save off the form parameters into a hash, and stuff
> the hash into a BLOB with Data:umper or Storable or some such module.
>
> > the problem i see is that a cgi script is not delivered a form, it's
> > delivered the names/values _in_ a form when that form was submitted. one
> > possibility: have your form handler read in the static html file
> > containing the form, fill it in, and save it to your db in a blob field
> > (ugh!)

>
> Ick. Just save the form parameters and values, and use CGI.pm to
> re-create the form along with the values you loaded from the
> database. Why make things so needlessly complicated?
>
> -=Eric


here's why:

the o.p. asked to save the _form_. forms are more than simply names and
values. they involve input methods of indicating those values (text
boxes, radio button, checkboxes, select's, etc.). your method does not
allow the o.p. to recreate the form with those methods intact.
admittedly, the o.p. did not specifically say that's what he wanted, but
i assumed it.

--
Michael Budash
 
Reply With Quote
 
Eric Schwartz
Guest
Posts: n/a
 
      10-02-2003
Michael Budash <(E-Mail Removed)> writes:
>> Ick. Just save the form parameters and values, and use CGI.pm to
>> re-create the form along with the values you loaded from the
>> database. Why make things so needlessly complicated?
>>
>> -=Eric

>
> here's why:
>
> the o.p. asked to save the _form_. forms are more than simply names and
> values. they involve input methods of indicating those values (text
> boxes, radio button, checkboxes, select's, etc.). your method does not
> allow the o.p. to recreate the form with those methods intact.


Yes it does. That's what the bit about "use CGI.pm to re-create the
form along with the values you loaded from the database" was about.
Of course, CGI.pm isn't necessary, but its sticky form creator will
work as well as any other.

If you generate the form programatically in the first place, then
adding code that looks like

{
no warnings;
my %vals = loadFormValues();

print <<EOFORM
.....
<input name="somename" value="$vals{somename}">
.....
EOFORM
}

is easy, and *poof*, there's your re-created form, with values
pre-filled from a database.

> admittedly, the o.p. did not specifically say that's what he wanted, but
> i assumed it.


You also assumed that the form is static, and not able to be generated
by a script. Seems a very baroque assumption to make, especially when
it makes the solution much harder.

-=Eric
--
Come to think of it, there are already a million monkeys on a million
typewriters, and Usenet is NOTHING like Shakespeare.
-- Blair Houghton.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
DataBase DataBase DataBase DataBase scott93727@gmail.com Computer Information 0 09-26-2012 09:40 AM
trouble with inserting data into oracle database from a web form geeteshss ASP .Net 0 06-20-2007 05:51 AM
install_driver(Oracle) failed: Can't load 'C:/Perl/site/lib/auto/DBD/Oracle/Oracle.dll' for module DBD::Oracle: load_file:The specified procedure could not be found at C:/Perl/lib/DynaLoader.pm line 230. Feyruz Perl Misc 4 10-14-2005 06:47 PM
Re: Software Developer to transcribe Oracle database into Access database Fluker MCSD 0 07-09-2003 01:20 PM
Re: Software Developer to transcribe Oracle database into Access database Guy Cox MCSD 1 07-09-2003 08:07 AM



Advertisments