Hello. I making a buddy list feature for my website. Its a online teen community and I'd thought it would be neat to have a buddylist feature.
I have a text box, select multiple list, and 2 images. The images are submit buttons. (input type="image") One image says "add buddy" and the other one says "delete buddy." The add buddy would add that buddy typed in the text box and delete buddy would delete the buddy/ies in the list.
The form uses the POST method and action calls to buddylist.cgi.
Now how would I distinguish wether the user clicked the add buddy image to get to buddylist.cgi or delete buddy to get to buddylist.cgi?
<select multiple size="15" style="background-color: #FFC666; color: #0
+066CC; font-family: verdana,geneva,courier; font-size: 12;" name="bud
+dies">
EOF
open(IsF, "<$buddyfile");
@buddylist = <IsF>;
close(IsF);
foreach $buddylist (@buddylist) {
chomp $buddylist;
print "<option value=\"$buddylist\">$buddylist</option>";
}
print <<EOF;
</select><br>
<input type="text" value="" name="buddyname"><br>
<input type="image" src="http://www.teen-reality.com/images/manav/bl/a
+ddbuddy.jpg" name="bloption" value="add">
<input type="image" src="http://www.teen-reality.com/images/manav/bl/d
+eletebud.jpg" name="bloption" value="delete">
</form>
EOF
---------
Thats the form printed out from the CGI.
I tried this for the PERL code to distinguish wether the user wants to add or delete a buddy.
$bloption = $INPUT{'bloption');
if ($bloption eq "add") {etc.
}
else {
delete buddy}
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.