Hi, No, I'm not asking anyone to go through all the code i posted... I did post a test url...I have tried online manuals, multiple forums, and i can't find any info on dynamic Perl forms... The Error I am getting is I can bring up the correct subcat page, but can't get the 2nd dropdown to display the subcats, when I select a cat from the 1st dropdown...and can't get my subcats into a dropdown box? I expect to create a Main Cat dropdown that, when a Main Cat is selected, a 2nd dropdown displays the respective subcats...until there are no more cats, then displays, No More Cats... The "Post new Item" form works fine...I am just trying to create dynamic dropdowns inside this form??? I posted the entire sub to let anyone who knows Perl, see what I am trying to do... I made progress again, but still aint there??? I removed the 1st dropdown code and for some reason, I am still displaying a dropdown at the top...if you pick a cat from the top dropdown, then hit the go button in the "Select Category" dropdown, it goes to that category page...but if you select a cat in the "select category" dropdown, it doesn't change? I still need to find out how to make the 1st dropdown populate the 2nd dropdown with the correct sub cat list??? Heres my test script: www.efret.com/cgi-bin/test/test35.pl Heres the code:
#-############################################# # Sub: Add New Item # This allows a new item to be put up for sale sub new { my ($title, $reserve, $inc, $desc, $image, $buyit, @bids); my $inc = '1.00'; # default increment if ($form{'REPOST'}) { $form{'REPOST'} =~ s/\W//g; if (-T "$config{'basepath'}$config{'closedir'}/$form{'REPOST'}.dat") + { open THEFILE, "$config{'basepath'}$config{'closedir'}/$form{'REPOST'}.dat"; ($title, $reserve, $inc, $desc, $image, $buyit, @bids) = <THEFILE>; close THEFILE; chomp($title, $reserve, $inc, $desc, $image, $buyit, @bids); } } print <<"EOF"; <!-- Add the following line to add a back button - between (print <<"E +OF";) & (EOF) --> <input type="button" name="Button" value="Back" onClick="MM_callJS('i +f (history.length &gt; 0){history.back()}')"> ##################### # Post new Item Form <FORM ACTION=$ENV{'SCRIPT_NAME'} METHOD=POST> <H2>Post A New Item</H2> <TABLE WIDTH=100% BORDER=1 BGCOLOR=$config{'colortablebody'}> <INPUT TYPE=HIDDEN NAME=action VALUE=procnew> <TR><TD VALIGN=TOP><B>Title/Item Name:<BR></B>No HTML</TD><TD><INPUT N +AME=TITLE VALUE=\"$title\" TYPE=TEXT SIZE=50 MAXLENGTH=50></TD></TR> <TR><TD VALIGN=TOP><B>Category:<BR></B>Select One</TD><TD> ##################### # Select Main Cat pulldown ###################################################################### +##################### print "<form ACTION=$ENV{'SCRIPT_NAME'} method=post> ", my $catinfo="<!--$form{category}-->";$catinfo=~s/\:/--><!--/g;$catinf +o=~s/<!---->//g; umask(000); my($key, %numfiles, %mycategory, %caticon); foreach $key (keys %category) { next if $category{$key}!~/^\Q$catinfo\E/; opendir(THEDIR, "$config{'basepath'}$key") || mkdir("$config{'basepath'}$key", 0777) || &oops("Category directory $k +ey could not be opened."); readdir THEDIR;readdir THEDIR; my @allfiles = readdir THEDIR; closedir THEDIR; if($category{$key} =~ /^\Q$catinfo\E<!--([^>]*)-->/ && $supercat{$1} + ne ''){ $mycategory{"$form{category}:$1"} = $supercat{$1}; $numfiles{"$form{category}:$1"} += @allfiles; $caticon{"$form{category}:$1"} = $config{supercaticon}; }else{ $mycategory{$key} = $category{$key}; $numfiles{$key} += @allfiles; $caticon{$key} = $config{regularcaticon}; } } my $cols = $config{maincatcols} || 2; my $pc = int(100/$cols); print "<select name=category>", my @keys = sort {lc $mycategory{$a} cmp lc $mycategory{$b}} keys %myc +ategory; my $definedkeys = $#keys + $cols-(($#keys+1)%$cols); my $cmove = int(@keys/$cols); $cmove++ if (@keys%$cols); for(my $i = 0;$i<=$cmove-1;$i++) { # print "<tr>"; my $j = $i; for(1..$cols){ my $key=$keys[$j]; if($key ne ''){ print "<OPTION value=$key>@mycategory{$key}</OPTION>", }else{ print( # Print Padding (Empty Cells) "<td>&nbsp;</td>", ); } $j+=$cmove; } } print ( "<INPUT TYPE='SUBMIT' NAME=action VALUE='go'>", "</select>", "</tr>", ); ###################################################################### +##################### ##################### </SELECT></TD></TR> ######################### <TR><TD VALIGN=TOP><B>Image URL:<BR></B>Optional, should be no larger +than 200x200</TD><TD><INPUT NAME=IMAGE VALUE=\"$image\" TYPE=TEXT SIZE=50 VALUE="http://"></TD></TR> <TR><TD VALIGN=TOP><B>Days Until Close:<BR></B>1-30</TD><TD><INPUT NAM +E=DAYS TYPE=TEXT SIZE=2 MAXLENGTH=2></TD></TR> <TR><TD VALIGN=TOP><B>Description:<BR></B>May include HTML - This shou +ld include the condition of the item, payment and shipping information, and any other information the buyer should know.</TD><TD><TEXTAREA NAME=DE +SC ROWS=5 COLS=45>$desc</TEXTAREA></TD></TR> <TR><TD COLSPAN=2 VALIGN=TOP>Please note that by placing an item up fo +r bid you are making a contract between you and the buyer.<br> Once you place an item, you may not retract it and you must sell it fo +r the highest bid.<br> In other words, if you don't want to sell it, don't place it up for bi +d! EOF if ($config{'regdir'}) { print <<"EOF"; <P><B><A HREF="$ENV{'SCRIPT_NAME'}?action=reg">Registration</A> is req +uired to post or bid!</B></TD></TR> <TR><TD VALIGN=TOP><B>Your Handle/Alias:<BR></B>Used to track your pos +t</TD><TD><INPUT NAME=ALIAS TYPE=TEXT SIZE=30 MAXLENGTH=30> <TR><TD VALIGN=TOP><B>Your Password:<BR></B>Must be valid</TD><TD><INP +UT NAME=PASSWORD TYPE=PASSWORD SIZE=30> <TR><TD VALIGN=TOP><B>Your Starting Bid:</B></TD><TD>\$<INPUT NAME=BID + TYPE=TEXT SIZE=7 VALUE=0> <TR><TD VALIGN=TOP><B>Your Reserve Price:<BR></B>You are not obligated + to sell below this price. Leave blank if none.</TD><TD>\$<INPUT NAME=RESERVE TYPE=TEXT S +IZE=7 VALUE=0> <!-- ############################ --> <TR><TD VALIGN=TOP><B>Bid Increment:</B></TD><TD>\$<INPUT NAME=INC TYP +E=TEXT SIZE=7 VALUE="$inc"></TD></TR> <TR><TD VALIGN=TOP><B>Buy-it Now:</B><BR>Optional, this feature allows + the first bidder to win the auction with a bid at this set price.</TD><TD>\$<INPUT NAME="B +UYIT" TYPE="text" SIZE="7"></TD></TR></TABLE> <!-- ############################ --> EOF } else { print <<"EOF"; </TD></TR> <TR><TD VALIGN=TOP><B>Your Handle/Alias:<BR></B>Used to track your pos +t</TD><TD><INPUT NAME=ALIAS TYPE=TEXT SIZE=30 MAXLENGTH=30> <TR><TD VALIGN=TOP><B>Your E-Mail Address:<BR></B>Must be valid</TD><T +D><INPUT NAME=EMAIL TYPE=TEXT SIZE=30> <TR><TD VALIGN=TOP><B>Your Starting Bid:</B></TD><TD>\$<INPUT NAME=BID + TYPE=TEXT SIZE=7 VALUE=0> <TR><TD VALIGN=TOP><B>Your Reserve Price:<BR></B>You are not obligated + to sell below this price. Leave blank if none.</TD><TD>\$<INPUT NAME=RESERVE TYPE=TEXT S +IZE=7 VALUE=0> <TR><TD VALIGN=TOP><B>Bid Increment:</B></TD><TD>\$<INPUT NAME=INC TYP +E=TEXT SIZE=7 VALUE="$inc"> <!-- ############################ --> <TR><TD VALIGN=TOP><B>Buy-it Now:</B><BR>Optional, this feature allows + the first bidder to win the auction with a bid at this set price.</TD><TD>\$<INPUT NAME="B +UYIT" TYPE="text" SIZE="7"> <!-- ############################ --> <TR><TD VALIGN=TOP><B>Contact Information:<BR></B>Will be given out on +ly to the buyer</TD><TD> <TT>Full Name: </TT><BR><INPUT NAME=ADDRESS1 TYPE=TEXT SIZE=30><BR> <TT>Street Address: </TT><BR><INPUT NAME=ADDRESS2 TYPE=TEXT SIZE=30><B +R> <TT>City, State, ZIP: </TT><BR><INPUT NAME=ADDRESS3 TYPE=TEXT SIZE=30> +</TD></TR></TABLE> EOF } print <<"EOF"; <CENTER>Adult Content IS NOT Allowed!!! <INPUT TYPE=SUBMIT VALUE=Previ +ew></CENTER> EOF }
Javascript may be the answer, but I don't know how to integrate it with my cat & subcat variables yet!!!,( I don't want to have to enter my 18000 cats/Subcats another time) and was hoping to do this in Perl... Now what? Any help is appreciated?

20040711 Edit by ysth: add code tags


In reply to Re^2: Select Category dropdowns? by efret
in thread Select Category dropdowns? 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.