CGI Development

Moderators: Jonathan
Number of threads: 57
Number of posts: 124

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
CGI Processing of MySQL variables Posted by typomaniac101 on 22 Apr 2009 at 4:12 AM
I am writing a script which will display requests which when submitted will be stored in a MySQL database. The requests are displayed on a paginatied page(if it makes any difference). Each request needs to have two radio inputs---one for approve and one for disapprove. Must be on or the other, if not checked either way it will simply remain in the database till another day. The requests are stored in a "holding" table and upon approve or disapprove they are deleted from that table and moved to other tables accordingly. Here's the question---how do I do it? Each set of radio inputs would need a unique name and the simplest thing I could think of would be just to append the field name in the manner of <input type=radio name=approve_$ref->{'number'}value=app>. So far so good(I think). The reason I didn't use a for loop to assign the numbers was because the last page might not have the number of entries allowed per page. The problem remains however getting the values to the next page. It is no problem to write the processing page on the fly as the form is on a .pl page and do something similar to the following at the bottom of the page.

open(CWK,">process2.pl");
print CWK"\#!/usr/bin/perl\n";
print CWK"require \"../../../cgi-lib.pl\"\; \n";

print CWK"use DBI\; \n";
print CWK"&ReadParse\; \n";
print CWK"print&PrintHeader\;\n";

print CWK"use CGI::Carp qw(fatalsToBrowser)\; \n";

print CWK"if(\$in{\'number\'} eq \$ref->{\'approve$a\'}) { \n";

Doing it this way allows me to assign variable numbers such as the ones from the auto-incremented column or from a for loop.

In the above I was using the auto incremented number and giving $approve the value of number and if they matched I could continue.

The problem is when I process the form using the auto-incremented numbers only the last number appears for proccessing.
I hope my question makes sense---I've been up more than a few nights trying to figure this one out. About the cgi-lib.pl file, I'm in the process of learning CGI.PM but just starting on that one but eventually all the scripts will be converted.



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.