Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

CGI Processing of MySQL variables

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 {'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
";
print CWK"require "../../../cgi-lib.pl";
";

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

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

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

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.
Sign In or Register to comment.