Jump to content

setting several selects to a specific position


jaco

Recommended Posts

Hi guys, thank for any help. This does not appear like a difficult problem but it has me stymied. I have several selects, the 1st item of each is "--Specify--" so that the user has to specifically choose an item. Once an item is selected on any select the others should be set to the 1st item or "--Specify--" to avoid confusion.

 

If you want to see the complete code it on this web page: http://chordsandguitar.com/progressions-test.php

 

The relevant code is:

 

if ($prog1_menu != "--Specify1--")
{
 $prog2_menu = "--Specify--";
 echo "set prog2 to Specify"; 
 }

if ($prog2_menu != "--Specify2--")
{
 $prog1_menu = "--Specify--";
 echo "set prog1 to Specify"; 
 }

echo "<form action = \"progressions-test.php?s_sort_all=$sort_all&s_prog1_menu=$prog1_menu&s_prog2_menu=$prog2_menu&s_prog1_trigged=$prog1_trigged&s_prog2_trigged=$prog2_trigged\" method = \"GET\">";
//also stores the values of the drop-downs when Select button is pushed so they can be retrieved when the web page is loaded again



echo "                                                 Ascending bass line";
echo "<br />";
echo "Select a progression: <a href=\"http://www.chordsandguitar.com/progressions-test.php?s_sort_all=All&s_prog1_menu=--Select--&s_prog2_menu=--Select--\"\"><big>ALL</big></a>";
echo "     ";

echo "<select name=\"prog1_menu\"  onchange=\"this.form.submit();\">";

echo "<option value=\"--Specify1--\">--Specify--</option>";
if ($prog1_menu == "ii-iii-IV-V progression") echo	"<option SELECTED value=\"ii-iii-IV-V progression\">ii-iii-IV-V progression</option>";
else echo	"<option value=\"ii-iii-IV-V progression\">ii-iii-IV-V progression</option>";
if ($prog1_menu == "I-ii-IV-V progression") echo	"<option SELECTED value=\"I-ii-IV-V progression\">I-ii-IV-V progression</option>";
else echo	"<option value=\"I-ii-IV-V progression\">I-ii-IV-V progression</option>";
if ($prog1_menu == "I-iii-IV-V progression") echo	"<option SELECTED value=\"I-iii-IV-V progression\">I-iii-IV-V progression</option>";
else echo	"<option value=\"I-iii-IV-V progression\">I-iii-IV-V progression</option>";
echo  "</select>";

echo "   ";

echo "<select name=\"prog2_menu\" onchange=\"this.form.submit();\">";

echo "<option value=\"--Specify2--\">--Specify--</option>";
if ($prog2_menu == "I-sharpIo7-ii7-sharpIIo7 progression") echo	"<option SELECTED value=\"I-sharpIo7-ii7-sharpIIo7 progression\">I-#Io7-ii7-#IIo7 progression</option>";
else echo	"<option value=\"I-sharpIo7-ii7-sharpIIo7 progression\">I-#Io7-ii7-#IIo7 progression</option>";
if ($prog2_menu == "I-sharpIo7-ii7-V7 progression") echo	"<option SELECTED value=\"I-sharpIo7-ii7-V7 progression\">I-#Io7-ii7-V7 progression</option>";
else echo	"<option value=\"I-sharpIo7-ii7-V7 progression\">I-#Io7-ii7-V7 progression</option>";
echo  "</select>";

echo "</form>";

 

I am trying to identify which select box has been used so that I can set all the other boxes to the 1st item but I wind up re-setting all the boxes.

 

Cheers,

 

Jacques

Link to comment
Share on other sites

I assume you are setting $prog2_menu and $prog1_menu from the GET variables earlier in your PHP code?

 

You really need to learn to use some CSS.  This is UGLY!

echo "                                                 Ascending bass line";

Link to comment
Share on other sites

Sorry that's not going to work as both selects are in the same form and POSTED when one is selected.  If you really need two selects, for example major and minor scales, I would suggest you make the first selection with these options major, minor then depending on this selection, show different options in the second selection box.

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.