alhen
-
Posts
10 -
Joined
-
Last visited
Never
Posts posted by alhen
-
-
I am not sure if I need Javascript or Ajax. I assumed it would be PHP based.
You are correct... I am only collecting this data, to be displayed again in another multiple-select box, and possibly changed. This is an internal tool only, to keep track of information.
-
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?
-
It's been six days and I've gotten no replies. Is that because this is a difficult question or because it's a stupid question?
Any input on any level would be much appreciated.
Thank you, ~Alex
-
//adds time to server clock $dat = time() + 3600; //output adjusted time $time = date("H:ia", $dat);
<? echo "$time"; ?>
-
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?
-
can you include the code from the homepage that is calling the sidebar?
-
Oh, and you could add this after that other code to test if your "id" is being passed through:
<? echo $id; ?>
-
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(); ?>
-
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)
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:
[attachment deleted by admin]
Looping an array back into a multiple select field
in PHP Coding Help
Posted
I have already explain this, here:
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?