Jump to content

Please Help! Checkbox for more dropdowns


j.g.

Recommended Posts

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
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.