j.g. Posted August 28, 2007 Share Posted August 28, 2007 Hi All- I have a page that I want to give the user to add more than one link to... right now the default page has a title and one dropdown for a link: <form name="frm" method="post" action="<?php echo $PHP_SELF;?>"> <INPUT TYPE="HIDDEN" NAME="resource_id" VALUE="<?php echo $resource_id;?>" SIZE="50"> <INPUT TYPE="HIDDEN" NAME="operation" VALUE="<?php echo $operation; ?>"> <INPUT TYPE="HIDDEN" NAME="type_id" VALUE="<?php echo $type_id; ?>"> <h1>Add / Update Resources</h1> <table class="box_content" width="80%" border="0" cellpadding="0" cellspacing="0" > <tbody> <tr> <td class="contentnovertical"> <div style="padding: 5px;"> <table border="0" cellpadding="0" cellspacing="5" width="100%"> <tbody> <tr> <td>* Title:</td> <td><input name="title" value="<?php echo $title; ?>" size="50" type="text"></td> </tr> <tr> <td> <span class="plain_sub_head"> <span class="formlabel">* Link Page:</span> </span> </td> <td> <select name="url" onChange="show_offsite()"> foreach( $urls as $page => $location) { //echo "<option>loc: ".$location; //echo "url: ".$url."</option>"; echo "<option "; if( $url == $location ) { echo "SELECTED"; } echo " VALUE=\"".$location."\">".$page."</OPTION>\n"; } </select> </td> </tr> <tr> <td> <span id="offsite_label" style="display: none;">Offsite Link:</span> </td> <td> <span id="offsite_text" style="display: none;"> <input type="text" size="40" maxlength="100" name="offsite_url" value="<?php echo $offsite_url;?>"> </span> </td> </tr> <tr> <td align='center' colspan='2' class="box_heading"> <?php echo $section_heading;?> ( * - required field )</td> </tr> </tbody> </table> </div> </td> </tr> <tr> <td class="contentnovertical"> <div style="padding-top: 5px; padding-bottom: 5px;" nowrap="" align="center"> <input type="submit" class="submit_button" value="<?php echo $operation; ?>" > <A HREF="resources_updater.php?type_id=<?php echo $type_id;?>"><span class="content_text">Cancel</span></A> </div> </td> </tr> </tbody> </table> </form> <script type="text/javascript"> show_offsite(); function show_offsite() { if (document.frm.url.value == 'offsite') { document.getElementById("offsite_text").style.display = "inline"; document.getElementById("offsite_label").style.display = "inline"; } else { document.getElementById("offsite_text").style.display = "none"; document.getElementById("offsite_label").style.display = "none"; } } </script> What I'd like to do is put a checkbox next to the current dropdown asking 'Add Another Link' -- and if this box is checked, show another dropdown under it.... All help will be greatly appreciated! So, I need to add the box, and if it is checked, show another dropdown under it. Please let me know if I need to provide any additional information for you to help me solve this problem. Thanks! -j.g. Link to comment https://forums.phpfreaks.com/topic/67073-please-help-checkbox-for-more-dropdowns/ Share on other sites More sharing options...
j.g. Posted August 28, 2007 Author Share Posted August 28, 2007 OK, I got the dropdown on the page, now I just need to know how to, IF CHECKED, show another link in another row under it... <tr> <td> <span class="plain_sub_head"> <span class="formlabel">* Link Page:</span> </span> </td> <td> <select name="url" onChange="show_offsite()"> foreach( $urls as $page => $location) { //echo "<option>loc: ".$location; //echo "url: ".$url."</option>"; echo "<option "; if( $url == $location ) { echo "SELECTED"; } echo " VALUE=\"".$location."\">".$page."</OPTION>\n"; } </select> <input type="checkbox" name="add_link"> Add Another Link </td> </tr> Thanks much! -j.g. Link to comment https://forums.phpfreaks.com/topic/67073-please-help-checkbox-for-more-dropdowns/#findComment-336393 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.