CGI that lists and sorts form data??

This is a discussion on "CGI that lists and sorts form data??" within the Web Page Design section. This forum, and the thread "CGI that lists and sorts form data?? are both part of the Design Your Website category.



Go Back   Webforumz.com > Main Forums > Design Your Website > Web Page Design

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Aug 28th, 2005, 08:27
New Member
Join Date: Aug 2005
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
CGI that lists and sorts form data??

I need a cgi script that when executed through a form adds the values inputed to a list (existing on the same page) and sorts them according to one of the form fields (date to be specific)

example:
form with 3 fields a, b (date field) and c
fill it out, press submit, and the three values show up right below (in text fields I suppose would be the only way to go, that's fine)
repeat the process
and there's another line added again with the newly inputed values in them

here's the thing I don't know if I can make text fields show dynamicly with new lines of data submitted without refreshing the page (I could at very least use iframe and refresh that if that would be the only option)

the twist here is that I want those lines of data to sort according to the date ("Aug 12 2005" format but I could have it as digits if sorting months by name is too complex)

...anyone seen a script like this anywhere?

I'd appreciate it
Reply With Quote

  #2 (permalink)  
Old Aug 28th, 2005, 12:29
Junior Member
Join Date: Aug 2005
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
The script is easy enough in Perl. I won't comment on the HTML portion except to say, I'd use an iframe.

To answer your question on the script, use an associative array to hold the month data. I'm sure there is even a simpler way if you research existing CPAN stuff but I would do the following as it is only 1 minute to type it up:

%months=();
$months{'january'} = 1;
$months{'february'} = 2;
...
$months{'december'} = 12;

or you could put the values as strings like "01"..."12"...depending on the type of sorting you use.

Then in your sort function pass the form month string value as the key to the associative array (that will give you the numeric value):

$months{$form_month}

I hope this helps.
Reply With Quote
  #3 (permalink)  
Old Aug 28th, 2005, 16:40
New Member
Join Date: Aug 2005
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
I appreciate your help,

Honestly I haven't worked with forms that much hence not much cgi/pearl experience either

suppose I go with the iframe option, what has to be done on the target page side, one in the iframe, to make it work? or is it all handeled by the script?

thanks
Reply With Quote
  #4 (permalink)  
Old Aug 29th, 2005, 07:51
Junior Member
Join Date: Aug 2005
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
HTML 4.01 says you can set the TARGET attribute of the FORM tag. If the browsers support it, then that solves your iframe problem.
Reply With Quote
Reply

Tags
cgi, lists, sorts, form, data

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 On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Sending Form Data to E-mail Address Fools Gold Starting Out 4 Dec 23rd, 2007 14:16
Form creating record but not adding data Andrew1986 Databases 22 Oct 19th, 2007 08:47
Form data to MySql casper22 Introduce Yourself 4 Aug 8th, 2006 21:30
Working with Form 'file field' data in ASP. daryl Classic ASP 3 Jun 24th, 2006 20:22
About sending form-data to an email address a.jenery Web Page Design 4 Mar 3rd, 2006 12:17


All times are GMT. The time now is 08:47.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43