Jump to content

alhen

Members
  • Posts

    10
  • Joined

  • Last visited

    Never

Posts posted by alhen

  1. I have already explain this, here:

    I am only collecting this data, to be displayed again in another multiple-select box, and possibly changed.

    It is because I don't need to simply display the data... I'm already way past that. I need to be able to alter it again because it may change periodically. And I do not need sub-categories. I need it how I've described in my previous posts.

     

    I really do appreciate your questions, but do you have any actual advice that can guide me in the right direction?

  2. hmmm... I'm not really sure how else to explain this. The images I included show what I am trying to achieve.

     

    Lets say the multiple select field has:

     

    Option 1

    Option 2

    Option 3

    Option 4

     

    And I selected:

    Option 1

    Option 4

     

    Only those 2 are entered into the database... now - what I want to do is display the the full menu, with Option 1 & 4 still selected - and Option 2 & 3 not selected. Like this:

     

    Option 1 (selected)

    Option 2 (not selected)

    Option 3 (not selected)

    Option 4 (selected)

     

    As it stands now it looks like this:

    Option 1 (selected)

    Option 4 (selected)

    Option 1 (not selected)

    Option 2 (not selected)

    Option 3 (not selected)

    Option 4 (not selected)

     

    As you can see there are duplicate options 1 & 4. Have I clarified this at all or have I obfuscated the question?

  3. Ok, I'm not getting any hits so I thought I'd try to jump start something...

     

    What I imagine happening is something like this:

    <?php if($pieces[] == "society_inf[]"){echo "<option value=\"$pieces[0]\" selected>$pieces[0]</option>"; } else { echo "";}?>
    

     

    I know that's not right, but is there a way to loop this information through kinda like this?

  4. If I understand, right... this seems simpler:

     <?php
    $id=$_GET['id'];
    
    MYSQL_CONNECT(localhost, username, password) OR DIE("DB connection unavailable");
    @mysql_select_db( "database") or die( "Unable to select database"); 
    
    $query="SELECT * FROM table WHERE id='$id' "; 
    
    mysql_query($query);	
    mysql_close();
    ?>

  5. Hi there,

    I'm trying to populate a multiple select field from mysql. I already have the info stored in mysql, and separated by "<br>". Now I'm calling that info back like this:

     

    <? 
    	$pieces = explode("<br>", $society_inf); // society_inf is the mysql field name AND the variable name, for simplicity
    	?>
    	<select name="society_inf[]" multiple="multiple" id="society_inf" tabindex="290">
    	<?php if($pieces[0] !== ""){echo "<option value=\"$pieces[0]\" selected>$pieces[0]</option>"; } else { echo "";}?>
    	<?php if($pieces[1] !== ""){echo "<option value=\"$pieces[1]\" selected>$pieces[1]</option>"; } else { echo "";}?>
    	<?php if($pieces[2] !== ""){echo "<option value=\"$pieces[2]\" selected>$pieces[2]</option>"; } else { echo "";}?>
    	<?php if($pieces[3] !== ""){echo "<option value=\"$pieces[3]\" selected>$pieces[3]</option>"; } else { echo "";}?>
    	<?php if($pieces[4] !== ""){echo "<option value=\"$pieces[4]\" selected>$pieces[4]</option>"; } else { echo "";}?>
    	<option value="AAPM – American Academy of Pain Medicine" selected>AAPM – American Academy of Pain Medicine</option>
    	<option value="APS – American Pain Society">APS – American Pain Society</option>
    	<option value="AACE – American Association of Clinical Endocrinologists">AACE – American Association of Clinical Endocrinologists</option>
    	<option value="ECE – European Congress of Endocrinology">ECE – European Congress of Endocrinology</option>
    	<option value="ENDO – The Endocrine Society">ENDO – The Endocrine Society</option>
    	<option value="ENEA – European Neuro Endocrine Association">ENEA – European Neuro Endocrine Association</option>
    	<option value="ESPE – European Society for Paediatric Endocrinology">ESPE – European Society for Paediatric Endocrinology</option>
    	<option value="LWPES – Lawson-Wilkins Pediatric Endocrine Society">LWPES – Lawson-Wilkins Pediatric Endocrine Society</option>
    	</select>

     

    Here's what it looks like: (the two selected ARE supposed to be)

    box.jpg

    You can see this looks kind of ugly, but it's almost working for me.

     

    My question is:

    Is there a way to loop this array to where it only shows me the selected items (still selected) and the non-selected items (still NOT selected), but no duplicates?

     

    I'd like it to look like this:

    box2.jpg

     

    [attachment deleted by admin]

×
×
  • 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.