Hi Monks,
I am creating a program to dynamic create table rows, the problem I am having is to delete the rows, I know I have commented out STRICT for testing propose only, can someone try to see if there is a way to do it by looking at my code?
Thank you!
Here is the code:

#!/perl/bin/perl #use strict; use CGI qw/:standard/; use CGI::Carp qw(fatalsToBrowser); use DBI; my $q = new CGI; my $tb_row = $q->param('tbrow'); my $one_less = $q->param('oneless'); my $temp_filename1 = $q->param('filenames1'); my ($selected1, $selected2, $selected3, $selected4, $selected5, $selec +ted6, $selected7, $selected8, $selected9, $selected10, $selected11); #print $q->header( "text/plain" ); print header(); print "******************* $temp_filename1 ********* $one_less******** +*"; =comment print "***$one_less***"; if( ($one_less){ $tb_row = $tb_row - $one_less; $tb_row = $tb_row - $one_less; print "<br>L27- Tb_row=$tb_row - Oneless=$one_less = Tb_row=$tb_row"; if($tb_row == -1){$tb_row_row = 0;} }#print "<br>L27<a href=\"tables.pl?tb_row=-1\"><font color=green><b>D +el Row - $topic - $tb_row - $xtop</font></b></a><br>"; =cut $tb_row = $tb_row + 1; my $decr_row = $tb_row - 2; if($decr_row == -1){$decr_row = 0;} #if($decr_row == 0){print "<br><b>L249 - TEST = $decr_row</b><br>" +;} $i=1; print " <table width=840 cellspacing=1 cellpadding=2 border=0 bgco +lor=\"#ffffff\"> <form action=\"tables.pl\" method=get name=installform> <!-- input type=hidden name=tb_row value=1 --><!-- input type +=hidden name=oneless value=1--> <tr> <td width=\"620\" colspan=5 align=\"left\"> <font face=\"verdana, helvetica, arial\" size=\"2\"><b> +Install From:</b></font> </td> <td width=\"220\" colspan=5 align=\"center\"> <font face=\"verdana, helvetica, arial\" size=\"2\"><b> +Install To:</b></font>&nbsp;&nbsp;&nbsp;&nbsp; </td> </tr> </table> <table width=840 cellspacing=1 cellpadding=2 border=0 bgco +lor=\"#ffffff\" align=center> <tr> <td width=\"160\" colspan=0 align=\"left\"><font face=\"verd +ana, helvetica, arial\" size=\"1\"><b>Directory:</b></font> </td> <td width=\"160\" colspan=0 align=\"left\"><font face=\"ve +rdana, helvetica, arial\" size=\"1\"><b>File Name</b></font> </td> <td width=\"110\" colspan=0 align=\"left\"><font face=\"ve +rdana, helvetica, arial\" size=\"1\"><b>Destination</b></font> </td>"; #if($tb_row >= 3){ #print " <td width=\"60\" colspan=0 align=\"left\"><font face=\"verdan +a, helvetica, arial\" size=\"1\"> print " <td width=\"60\" colspan=0 align=\"left\"><font face=\"verdana +, helvetica, arial\" size=\"1\"> <a href=\"tables.pl?oneless=1\" onclick=\"document.getEl +ementById('installform').submit(); return false;\" ><b>Del Row</b></a +><!-- a href=\"javascript:history.go(-1)\">Del Row</a --></font>"; #} <a onclick="return confirmSubmit()"href="/articles/artic +les/javascript/confirmsubmit.asp?ID=<%=siteID%>">delete</a> print " </td> </tr> <input type=hidden name=sign_off value=$sign_off> <input type=hidden name=t_number value=$t_number> <input type=hidden name=mis_sign value=$mis_sign> <input type=hidden name=sign_date value=$sign_date> <input type=hidden name=user_name value=$user_name> <input type=hidden name=descriptions value=$description +> <input type=hidden name=transaction value=print_form> <input type=hidden name=form_name value=continue> <input type=hidden name=action value=$action> <input type=hidden name=addrow value=addrow> <input type=hidden name=tbrow value=".$tb_row."> <input type=hidden name=trackingid value=$trackingid> <input type=hidden name=datereq value=$date_req> <input type=hidden name=reqinstallon value=$req_install +_on> <input type=hidden name=stginstall value=$stg_install> <input type=hidden name=prodinstall value=$prod_install +> <input type=hidden name=reqname value=$req_name> <input type=hidden name=projectname value=$project_name +> <input type=hidden name=projectdesc value=$project_desc +> <input type=hidden name=spcinstr value=$spcinstr> <input type=hidden name=datereq value=$date_req> <input type=hidden name=addtable value=addtable> <input type=hidden name=rrr value=$rrr> "; $c=-1; #$tb_row = 2; while ($i<($tb_row+1)) { $c++; $direc_data="direc_data".$i; $direc_temp=param($direc_data); $files_data="filenames".$i; $files_temp=param($files_data); $dest_data="dest_data".$i; $dest_temp=param($dest_data); if($dest_temp eq "A"){ $selected1="selected";}else +{$selected1=" ";} if($dest_temp eq "B"){ $selected2="selected";}else{$selected2= +" ";} if($dest_temp eq "C"){ $selected3="selected";}els +e{$selected3=" ";} if($dest_temp eq "D"){ $selected4="selected";}else{$select +ed4=" ";} if($dest_temp eq "E"){ $selected5="selected";}else{$selected +5=" ";} if($dest_temp eq "F"){ $selected6="selected";}else{$selected +6=" ";} if($dest_temp eq "G"){ $selected7="selected";}else{$sele +cted7=" ";} if($dest_temp eq "H"){ $selected8="selected";}else +{$selected8=" ";} if($dest_temp eq "I"){ $selected9="selected";}else{$selected9=" +";} if($dest_temp eq "J"){ $selected10="selected";}else{$selected1 +0=" ";} if($dest_temp eq "K"){ $selected11="selected";}else{$sel +ected11=" ";} if( ($direc_data=~/direc_data\d+/)&&($direc_temp eq "")){$tb_r +ow = $tb_row - ($tb_row - 1);} #else{print "No match - $tb_row";} #if( ($direc_data=~/direc_data\d+/)&&($direc_temp eq "")){$tb_ +row = $tb_row - 1;} #else{print "No match - $tb_row";} print " <input type=hidden name=c value=$c> <tr> <td width=\"160\" colspan=0 align=\"left\"> <font face=\"verdana, helvetica, arial\" size=\"1\">"; print "<input type=text name=\""; $direc_data="direc_data".$i; print $direc_data; print "\"value=$direc_temp>"; #<input type=\"text\" name=\"directories\" value=\"$directorie +s\"> print "</font> </td> <td width=\"160\" colspan=0 align=\"left\"> <font face=\"verdana, helvetica, arial\" size=\"1\">"; print "<input type=text name=\""; $files_data="filenames".$i; print $files_data; print "\"value=$files_temp>"; #<input type=\"text\" name=\"filenames\" value=\"$filenames\"> print "</font> </td> <td width=\"110\" colspan=0 align=\"left\"><font face=\"ve +rdana, helvetica, arial\" size=\"1\">"; print "<SELECT NAME=\""; #print "<input type=text name=\""; $dest_data="dest_data".$i; print $dest_data; #print "\"value=$dest_temp>"; print "\">"; print "<OPTION VALUE=\"\">SELECT</OPTION> <OPTION VALUE=\"A\" $selected1>A</OPTION> <OPTION VALUE=\"B\" $selected2>B</OPTION> <OPTION VALUE=\"C\" $selected3>C</OPTION> <OPTION VALUE=\"D\" $selected4>D</OPTION> <OPTION VALUE=\"E\" $selected5>E</OPTION> <OPTION VALUE=\"F\" $selected6>F</OPTION> <OPTION VALUE=\"G\" $selected7>G</OPTION> <OPTION VALUE=\"H\" $selected8>H</OPTION> <OPTION VALUE=\"I\" $selected9>I</OPTION> <OPTION VALUE=\"J\" $selected10>J</OPTION> <OPTION VALUE=\"K\" $selected11>K</OPTION> </SELECT>"; my $rrr = $tb_row -1; print " </font> </td> <td width=\"60\" colspan=0 align=\"left\"> <font face=\"verdana, helvetica, arial\" size=\"1\"><a +href=\"tables.pl\" onclick=\"document.getElementById('installform').s +ubmit(); return false;\">Add Rows</a></font> </td> </tr> "; } continue{ $i++;} print "<input type=\"hidden\" name=\"tb_row\" value=\""; print $tb_row; print "\">"; print "</table>"; my $i=1; #$tb_row = $tb_row + 1; #print "<br><font color=red>^^^^^^^ $c^^^^^^^^^ $i --- $tb_row ^^^ +^^^^^^^^^^^</font><br>"; while ($i<=$c) { $direc_data="direc_data".$i; $direc_temp=param($direc_data); $files_data="filenames".$i; $files_temp=param($files_data); $dest_data="dest_data".$i; $dest_temp=param($dest_data); #push (@array,$direc_temp); #if($direc_temp){ print "<font color=#000000>$i## $direc_data=$direc_temp ## $array[ +$i] ## </font><br>"; #$transaction, $sub_status print "<font color=green>$i## $files_data=$files_temp ## $array[$i +] ## </font><br>"; print "<font color=red>$i## $dest_data=$dest_temp ## $array[$i] ## + </font><br>"; #} } continue{ $i++;}

Thanks

READMORE tags added by Arunbear


In reply to Deleting Problem by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.