Connecting Tech Pros Worldwide Forums | Help | Site Map

Php Drop Down Menu Passing Last Row In Array

SHOverine's Avatar
Newbie
 
Join Date: Sep 2006
Location: Cleveland, OH
Posts: 18
#1: 4 Weeks Ago
I have an issue with a drop down menu that I am hoping you all can help me with. The issue is when I press "Submit", my code prints back values from a form I developed (eventually I will write them to a database). In this form, I have a dynamically built drop down (php/ mysql query). No matter which value I select, it always prints the LAST row in the table (array) as the selected value. My code follows:

1) I connect to database
2) I am building a set of forms using a loop statement where the variable '$a' increments by one each time through the loop.
3) I run code to get drop down array
Expand|Select|Wrap|Line Numbers
  1. $TVSQL = mysql_query("SELECT TVStation FROM NCF_tvstations");
  2.               echo "<form action=something.php method=POST> 
  3.               <select name=TVStation[$a]>";
  4. while ($r = mysql_fetch_array($TVSQL))
  5.  { $TVStation[$a] = $r["TVStation"]; echo "<option 
  6. value='$TVStation[$a]'>$TVStation[$a]</option>"; }
  7. echo "</select></td>";
  8.  
4) The web page for reference is: http://theweekly13.com/test/gamebuilder.php

Thanks for any help.

Cheers!
Seth
best answer - posted by TheServant
Again, your select name on line 2 is an array. This will not be able to be sent. The name needs to be scalar ("BBC" or "TVStation1") instead of an array like (TVStation[1]).
$_POST does not take variables in their arrays like you have ($_POST['$TVStration[$a]']). It takes the anme of the input that was sent, so if your select was called "TVStation1" (note it is not an array), then to call the value of that you would use $_POST['TVStation1'] (not no $ signs which denote variables).

To replace your code use:
Expand|Select|Wrap|Line Numbers
  1. $TVSQL = mysql_query("SELECT TVStation FROM NCF_tvstations ORDER BY TVStation ASC"); 
  2.               echo "<select name=TVStation".$a."><option value=''>Select TV</option>"; /*** Changed your name to output a scalar rather than an array*/
  3.                    while ($z = mysql_fetch_array($TVSQL))
  4.                          { 
  5.                           $TVStation_temp = $z["TVStation"]; /*** Changed your option value variable to a scalar variable rather than an array*/
  6.                           echo "<option value='$TVStation_temp'>$TVStation_temp</option>";  /*** Changed your option value variable to a scalar variable rather than an array (corresponding to previous change)*/
  7.                          }                        
  8.  
  9.                    echo "</select></td>"; 
  10.                    echo( $_POST['TVStation'.$a] );/*** Added an echo (if you don't use echo or print, nothing will be displayed), changed name to correspond to new select name in the form of TVStation1*/
  11.  
I have tried to use your code without changing anything more than needs to be changed, but read my comments and make sure you understand why that is the case. Two basic changes are: No array variable names or values, and no variables or arrays within $_POST.

TheServant's Avatar
Expert
 
Join Date: Feb 2008
Location: Australia
Posts: 919
#2: 4 Weeks Ago

re: Php Drop Down Menu Passing Last Row In Array


Hi Seth,
I am not sure why you are using an array in your loop, but you have not defined what $a is. Your select name is TVStation[$a] which is not a variable like you have in your while loop (which is $TVStation[$a]?? Is that intentional?
In your while loop, you reset what $TVStation[$a] is every loop, and because $a is not incrimented as you said your 'array' $TVStation is not an array, but rather a single value which will be the last TVStation pulled from MySQL.
To fix this you need:
Expand|Select|Wrap|Line Numbers
  1. $a++;
in your while loop.

How are you printing your selected value? Is it:
Expand|Select|Wrap|Line Numbers
  1. echo $_POST['TVStation[??]'];
where ?? is what ever $a's original value is? Give us some more information with how you display that as well us you're updated form code (if you choose to update that) and we can see where the mix up is.
SHOverine's Avatar
Newbie
 
Join Date: Sep 2006
Location: Cleveland, OH
Posts: 18
#3: 4 Weeks Ago

re: Php Drop Down Menu Passing Last Row In Array


I am using
Expand|Select|Wrap|Line Numbers
  1.  echo $TVStation[$a]; 
. Whenever I use $POST_, I lose the values and nothing prints.

I am using
Expand|Select|Wrap|Line Numbers
  1.  $a = $a+1 
to increment the variable each time the loop runs. Is
Expand|Select|Wrap|Line Numbers
  1.  $a++ 
a better method to accomplish this?

Here is the entire code in case you are wondering - a lot of this is in-progress and requires clean-up:
Expand|Select|Wrap|Line Numbers
  1. <?php
  2.  
  3. //Week Variable 
  4.  
  5. $Season_Start = mktime(0,0,0,8,30,2009);  
  6. $Season_End = mktime(0,0,0,12,8,2009);
  7. $Current_Date = mktime(date("H"), date("i"), date("s"), date("m"), date("d"), date("Y"));
  8.  
  9. // Gets session variable for 'Year'
  10. // Gets session variable for 'Week'
  11.  
  12. $Year = date("Y",$Season_Start);
  13. $h = (7*24*60*60);
  14. IF ($Current_Date < $Season_Start) 
  15.     {
  16.         $Week = 1; 
  17.  
  18.     }
  19. ELSE 
  20.     {
  21.         IF ($Current_Date < $Season_End)
  22.         {
  23.             $Week = CEIL((($Current_Date-$Season_Start)/$h));
  24.         }
  25.         ELSE 
  26.         {
  27.             $Week = CEIL(($Season_End-$Season_Start))/$h +1; 
  28.         }
  29.     }
  30.  
  31. //Connect to Database
  32.  
  33. $dbhost = "XXXXXX";
  34. $dbuser = "XXXX";
  35. $dbpass = "XXXXXXX";
  36.  
  37. function dbConnect($db="") {
  38.    global $dbhost, $dbuser, $dbpass;
  39.  
  40.    $dbcnx = @mysql_connect($dbhost, $dbuser, $dbpass)
  41.        or die("The site database appears to be down.");
  42.  
  43.    if ($db!="" and !@mysql_select_db($db))
  44.        die("The site database is unavailable.");
  45.  
  46.    return $dbcnx;
  47. }
  48.  
  49. dbconnect("theweekl_test"); 
  50.  
  51. ?>
  52.  
  53. <!doctype html public "-//w3c//dtd html 3.2//en">
  54. <html>
  55. <head>
  56. <title>The Weekly13 :: Gamebuilder</title>
  57.  
  58. <!-- Java script for OnChange of League to bring up Gamebuilder -->
  59.  
  60. <SCRIPT language=JavaScript>
  61.  
  62. function reload_A(form)
  63. {
  64. var val=form.League.options[form.League.options.selectedIndex].value;
  65. self.location='gamebuilder.php?League=' + val ;
  66. }
  67.  
  68. function reload_C(form)
  69. {
  70. var val=form.League.options[form.League.options.selectedIndex].value;
  71. var val2=form.GameCount.options[form.GameCount.options.selectedIndex].value; 
  72.  
  73. self.location='gamebuilder.php?League=' + val + '&GameCount=' + val2 ;
  74. }
  75.  
  76. </script>
  77.  
  78. <style type="text/css">
  79.  
  80. p1 {
  81. font-family: eurostile, arial, verdana;
  82. font-size: 22px;
  83. border: 4px solid #cd0000;
  84. text-align: center;
  85. color: #000066;
  86. font-weight: 900;
  87. }
  88.  
  89. </style>
  90.  
  91. </head>
  92.  
  93. <body
  94.  style="background-image: url(http://theweekly13.com/images/core/pabstheaderbg.jpg);">
  95.  
  96. <?php //header
  97.    $curl = curl_init();
  98.    curl_setopt ($curl, CURLOPT_URL, "http://theweekly13.com/include/header.php");
  99.    curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
  100.  
  101.    $result = curl_exec ($curl);
  102.    curl_close ($curl);
  103.    echo $result;
  104.  
  105.    echo "<br><br>";
  106.  
  107. $WeekIDSQL = mysql_query("SELECT WeekID FROM NCF_weeks WHERE Week = $Week");
  108. $WeekID = mysql_result($WeekIDSQL, 0);
  109.  
  110. @$League=$_GET['League'];
  111.  
  112. /* Data for League DropDown Box */
  113.  
  114. $queryUL = mysql_query("SELECT League, LeagueID FROM NCF_leagues  
  115.         ORDER BY LeagueID ASC");
  116.  
  117. echo "<form method=POST name=League_GameCount action=' '>";
  118.  
  119. /* First Drop down Menu */
  120.  
  121. echo "<table
  122.  style=\"width: 500px; text-align: left; margin-left: auto; margin-right: auto;\"
  123.  border=\"0\" cellpadding=\"4\" cellspacing=\"4\"><tbody><tr><td style=\"width: 250px; text-align: right;\">
  124.  <p>Select League:</p></td><td style=\"width: 237px;\">";
  125.  
  126. echo "<select name='League' onchange=\"reload_A(this.form)\"> <option value=''><p>Select League</p></option>";
  127.  
  128. while($r = mysql_fetch_array($queryUL)) { 
  129. if($r['League']==@$League){
  130. echo "<option selected value='$r[League]'>$r[League]</option>"."<BR>";}
  131. else{echo "<option value='$r[League]'>$r[League]</option>";}
  132. }
  133. echo "</select></td></tr>";
  134.  
  135. $_SESSION['$League'] = $League;
  136.  
  137. $queryGC = mysql_query("SELECT GameCount, GameCountID FROM NCF_gamecount ORDER BY gamecountID ASC");
  138.  
  139. /* Second Drop down Menu */
  140.  
  141. echo "<tr><td style=\"text-align: right;\"><p>Select Game Count:</p></td>
  142. <td><select name='GameCount' onchange=\"reload_C(this.form)\"><option value=''><p>Change Game Count</p></option>";
  143. while($t = mysql_fetch_array($queryGC)) {   
  144. echo  "<option value='$t[GameCount]'>$t[GameCount]</option>";
  145. }
  146.  
  147. $_SESSION['$GameCount'] = $GameCount;    
  148.  
  149. echo "</select></td></tr></tbody></table>";
  150. echo "<hr style=\"width: 800px; height: 4px; text-align: center;\">";
  151. echo "</form>";
  152.  
  153. /* ONCE GAMECOUNT IS SELECTED, GAME INFORMATION BOXES APPEAR */
  154.  
  155. if(isset($GameCount) )
  156.         {   
  157.  
  158.         echo "<form method=POST name=Gamebuilder action=''>";
  159.  
  160.         echo "<table style=\"background-color: #FFFF99; width: 800px; text-align: left; 
  161.         margin-left: auto; margin-right: auto;\"
  162.         border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tbody><tr>
  163.         <td style=\"text-align: left; \"><p1>&nbsp You are building ".$GameCount.' Games for the 
  164.         '.$League.' league for Week '.$Week."&nbsp</p1></td></tr></tbody></table><br>";
  165.  
  166.         $a = 1;
  167.         WHILE ($a <= $GameCount) {
  168.  
  169.         IF ($a < 10) {$GameNum = "0".$a; } else {$GameNum = $a;}
  170.  
  171.         $LeagueNumSQL = mysql_query("SELECT LeagueNumber FROM NCF_leagues WHERE League LIKE '$League'");
  172.         $LeagueNum = mysql_result($LeagueNumSQL, 0);
  173.  
  174.         $GameID[$a] = $Year.$WeekID.$GameNum.$LeagueNum; 
  175.  
  176.               echo "<table style=\"width: 800px; text-align: left; margin-left: auto; margin-right: auto;\"
  177.               border=\"3\" cellpadding=\"1\" cellspacing=\"1\">
  178.               <tbody><tr><td style=\"background-color: rgb(255, 255, 153);\" colspan=\"6\" rowspan=\"1\"><p>
  179.               Game ".$a." :: Game ID ".$GameID[$a]."</p></td></tr>";
  180.  
  181.               echo "<tr><td style=\"width: 289px; text-align: center;\" colspan=\"2\" rowspan=\"1\">Date/ 
  182.               Time:&nbsp; <input size=\"25\" name=\"DateTimes[$a]\" value=\"YYYY-MM-DD HH:MM:SS\"></td>";
  183.  
  184.               echo "<td style=\"width: 100px; text-align: center;\">";
  185.  
  186.               $TVSQL = mysql_query("SELECT TVStation FROM NCF_tvstations");
  187.               echo "<form action=something.php method=POST> <select name=$TVStation[$a]>";
  188.                    while ($r = mysql_fetch_array($TVSQL))
  189.                    { $TVStation[$a] = $r["TVStation"]; echo "<option value='$TVStation[$a]'>$TVStation[$a]</option>"; }
  190.                    echo "</select></td>";
  191.  
  192.               echo "<td style=\"width: 389px;\" colspan=\"3\" rowspan=\"1\">
  193.               GameNotes: <input size=\"45\" name=\"GameNotes".$a."\"></td>
  194.               </tr><tr><td colspan=\"3\" rowspan=\"1\">Away Team Information</td><td colspan=\"3\" rowspan=\"1\">Home Team
  195.               Information</td></tr><tr><td style=\"text-align: right; width: 75px;\"># <input
  196.               size=\"5\" name=\"AwayRank".$a."\">.</td>";
  197.  
  198.               echo "<td style=\"width: 189px; text-align: center;\">";
  199.  
  200.               $AwayTeamSQL = mysql_query("SELECT College FROM NCF_teams");
  201.               echo "<form action=something.php method=POST><select name=AwayTeam>";
  202.                    while ($r = mysql_fetch_array($AwayTeamSQL))
  203.                    { $AwayTeam = $r["College"]; echo "<option value='$AwayTeam'>$AwayTeam</option>"; }
  204.                    echo "</select></td>";
  205.  
  206.               echo "<td style=\"width: 100px;\">Line: <input size=\"5\" name=\"AwayLine".$a."\" value=\"0.0\"></td>
  207.               <td style=\"text-align: right; width: 75px;\"># <input size=\"5\" name=\"HomeRank".$a."\">.</td>";
  208.  
  209.               echo "<td style=\"width: 189px; text-align: center;\">";
  210.  
  211.               $HomeTeamSQL = mysql_query("SELECT College FROM NCF_teams");
  212.               echo "<form action=something.php method=POST><select name=HomeTeam>";
  213.                    while ($r = mysql_fetch_array($HomeTeamSQL))
  214.                    { $HomeTeam = $r["College"]; echo "<option value='$HomeTeam'>$HomeTeam</option>"; }
  215.                    echo "</select></td>";
  216.  
  217.               echo "</td><td style=\"width: 100px;\">Line: <input size=\"5\" name=\"HomeLine".$a."\" value=\"0.0\"></td>
  218.                </tr><tr><td style=\"width: 389px;\" colspan=\"3\" rowspan=\"1\">
  219.                Record: <input size=\"4\" name=\"AwayOAW".$a."\">-<input size=\"4\" name=\"AwayOAL".$a."
  220.                \">,&nbsp;<input size=\"4\" name=\"AwayCW".$a."\">-<input size=\"4\" name=\"AwayCL".$a."\">
  221.                </td><td style=\"width: 389px;\" colspan=\"3\" rowspan=\"1\">Record: <input size=\"4\" 
  222.                name=\"HomeOAW".$a."\">-<input size=\"4\" name=\"HomeOAL".$a."\">,&nbsp;<input size=\"4\" 
  223.                name=\"HomeCW".$a."\">-<input size=\"4\" name=\"HomeCL".$a."\"></td></tr></tbody></table><br>";
  224.  
  225.                $GameInsert = "INSERT INTO NCF_games (GameID, Game, WeekID, League, Year, DateTimes, Awayteam, AwayLine,
  226.                HomeTeam, HomeLine, GameNotes, GameTV, Notes) VALUES ($GameID, $a, $WeekID, $LeagueNum, $Year, $DateTimes.$a,
  227.                $AwayTeam, $AwayLine, $HomeTeam, $HomeLine, $GameNotes, $TVStation, $CurrentDate)";
  228.  
  229.                $GameInfoInsert = "INSERT INTO NCF_gameinfo (GameID, AwayTeam, AwayRank, AwayOAW, AwayOAL, AwayCW, AwayCL,
  230.                HomeTeam, HomeRank, HomeOAW, HomeOAL, HomeCW, HomeCL, Notes) VALUES ($GameID, $AwayTeam, $AwayRank, 
  231.                $AwayOAW, $AwayOAL, $AwayCW, $AwayCL, $HomeTeam, $HomeRank, $HomeOAW, $HomeOAL, $HomeCW, 
  232.                $HomeCL, $CurrentDate)";
  233.  
  234.              $a = $a + 1;
  235.         }
  236.  
  237.         echo "<div style=\"text-align: center;\"><input value=\"Reset Form\" type=\"reset\"> <input
  238.         name=\"submitok\" value=\"Submit\" type=\"submit\"></div></form>  ";
  239.  
  240.         $UserCountSQL = mysql_query("SELECT COUNT(UserName) FROM NCF_userstemp 
  241.         WHERE UserLeague = $LeagueNum AND UserName NOT LIKE '%SELECT%'");
  242.         $UserCount = mysql_result($UserCountSQL, 0);
  243.  
  244.         $UserSelectSQL = mysql_query("SELECT UserName FROM NCF_userstemp 
  245.         WHERE UserLeague = $LeagueNum AND UserName NOT LIKE '%SELECT%'");
  246.  
  247.         $UserIDSelectSQL = mysql_query("SELECT UserID FROM NCF_userstemp 
  248.         WHERE UserLeague = $LeagueNum AND UserName NOT LIKE '%SELECT%'");
  249.  
  250.  
  251.         if (isset($_POST['submitok'])) {  
  252.  
  253.         $b = 1;
  254.         WHILE ($b <= $GameCount) {
  255.  
  256.               echo $GameID[$b]." ".$DateTimes[$b]." ".$TVStation[$b]."<br>";
  257.               $b = $b +1;
  258.  
  259.         }
  260.  
  261.              }       
  262.         }
  263. else { echo "<br><br><div style=\"text-align: center;\"><p1>Enter Game Count & Select League</p1></div>"; } 
  264.  
  265. ?>
  266.  
  267.   </body>
  268. </html>
  269.  
TheServant's Avatar
Expert
 
Join Date: Feb 2008
Location: Australia
Posts: 919
#4: 4 Weeks Ago

re: Php Drop Down Menu Passing Last Row In Array


I won't read all your code, but I think I see your problem.
As explained before in your while loop when you have:
Expand|Select|Wrap|Line Numbers
  1. while ($r = mysql_fetch_array($TVSQL)) 
  2.  { $TVStation[$a] = $r["TVStation"]; echo "<option...
You are resetting $TVStation[$a] and overwriting it every time, so when you echo $TVStation[$a] you will end up with the last $r["TVStation"] that you set it at, which coincides with the last item on your select dropdown. It is not your dropdown that's failing.

The problem is you can't $_POST an array without serializing first, which basically turns the array into a string which can be unserialized (turned back into an array) after the $_POST data has been sent and received. You can read about it here or from any Google search about it.

If you do not use $_POST, you are not looking at any data from the form, but only that which you have in the PHP of the current page. If that doesn't make sense, you should read up on how forms are submitted and data is retrieved, and then the difference between $_POST and $_GET which will help you a lot.

I don't think that you need to be serializing, but instead, simply not to have your select name as an array... In other words, don't send arrays in $_POST.

And yes, $a++; is valid and faster, if you simply want an increment of 1.
SHOverine's Avatar
Newbie
 
Join Date: Sep 2006
Location: Cleveland, OH
Posts: 18
#5: 3 Weeks Ago

re: Php Drop Down Menu Passing Last Row In Array


I am still having trouble getting what's going on with the code I use. I use the exact same coding logic twice before on the same page but outside of the loop statement without issue.

I am using the loop statement because I am building multiple events; quantity determined by the user. The TV Station is a part of the event (the channel that the game is on), which can change for each event.

In your first response, you say:
Quote:
In your while loop, you reset what $TVStation[$a] is every loop, and because $a is not incremented as you said your 'array' $TVStation is not an array, but rather a single value which will be the last TVStation pulled from MySQL.
. I increment $a at the end of the loop. Also I don't see how I am resetting $TVStation[$a] When I view page source, I get the variables "TVStation[1]", "TVStation[2]", etc. However when I echo $TVStation[$a]; I always get the last row of the table, as if it is preselected for me.

As always, thanks for your help and patience. I am a hobbyist programmer, so most of my code is cobbled together from what I read on the net or get from sites like this one.
TheServant's Avatar
Expert
 
Join Date: Feb 2008
Location: Australia
Posts: 919
#6: 3 Weeks Ago

re: Php Drop Down Menu Passing Last Row In Array


You are quoting me from my first post which was a response to your first where you had no mention of your incrementing of $a, but you included that part in your second post which I acknoledged in my second post, and simply pointed out another incrementing technique available to PHP (and some other languages):
Expand|Select|Wrap|Line Numbers
  1. $a++; /* instead of */ $a = $a + 1;
On line 189 in the code above you are setting a value to $TVStation[$a]. Everytime you set a value you overwrite the previous value and so the last value which $TVStation[$a] is set at will be the last record from the database. That is why when you echo it you get the last row.

If you want to submit the form and use what was submitted (for example with an echo), you need to use $_POST or $_GET. These do not take arrays as variables and so the bottom line is: You cannot use an array as a form element name*.

* Forget what I mentioned before about serializing, I can't think of a way to use that in a form which is $_POSTed.

Hope that helps.
SHOverine's Avatar
Newbie
 
Join Date: Sep 2006
Location: Cleveland, OH
Posts: 18
#7: 3 Weeks Ago

re: Php Drop Down Menu Passing Last Row In Array


I apologize for confusing the two quotes.

I changed the code to this
Expand|Select|Wrap|Line Numbers
  1. $TVSQL = mysql_query("SELECT TVStation FROM NCF_tvstations ORDER BY TVStation ASC");
  2.               echo "<select name=TVStation[$a]><option value=''>Select TV</option>";
  3.                    WHILE ($z = mysql_fetch_array($TVSQL))   
  4.                          {
  5.                           $TVStation[$a] = $z["TVStation"]; 
  6.                           echo "<option value='$TVStation[$a]'>$TVStation[$a]</option>"; 
  7.                          }                       
  8.  
  9.                    echo "</select></td>";
  10.                    $_POST['$TVStation[$a]'];
  11.  
It still does not work. I tried about 50 different flavors, including just using a plain old HTML select option list and could not solve the issue. I am at a loss of how to accomplish this, maybe I can find a way without looping - which will be a real pain, but it's doable.

Thanks for your help.
TheServant's Avatar
Expert
 
Join Date: Feb 2008
Location: Australia
Posts: 919
#8: 3 Weeks Ago

re: Php Drop Down Menu Passing Last Row In Array


Again, your select name on line 2 is an array. This will not be able to be sent. The name needs to be scalar ("BBC" or "TVStation1") instead of an array like (TVStation[1]).
$_POST does not take variables in their arrays like you have ($_POST['$TVStration[$a]']). It takes the anme of the input that was sent, so if your select was called "TVStation1" (note it is not an array), then to call the value of that you would use $_POST['TVStation1'] (not no $ signs which denote variables).

To replace your code use:
Expand|Select|Wrap|Line Numbers
  1. $TVSQL = mysql_query("SELECT TVStation FROM NCF_tvstations ORDER BY TVStation ASC"); 
  2.               echo "<select name=TVStation".$a."><option value=''>Select TV</option>"; /*** Changed your name to output a scalar rather than an array*/
  3.                    while ($z = mysql_fetch_array($TVSQL))
  4.                          { 
  5.                           $TVStation_temp = $z["TVStation"]; /*** Changed your option value variable to a scalar variable rather than an array*/
  6.                           echo "<option value='$TVStation_temp'>$TVStation_temp</option>";  /*** Changed your option value variable to a scalar variable rather than an array (corresponding to previous change)*/
  7.                          }                        
  8.  
  9.                    echo "</select></td>"; 
  10.                    echo( $_POST['TVStation'.$a] );/*** Added an echo (if you don't use echo or print, nothing will be displayed), changed name to correspond to new select name in the form of TVStation1*/
  11.  
I have tried to use your code without changing anything more than needs to be changed, but read my comments and make sure you understand why that is the case. Two basic changes are: No array variable names or values, and no variables or arrays within $_POST.
SHOverine's Avatar
Newbie
 
Join Date: Sep 2006
Location: Cleveland, OH
Posts: 18
#9: 3 Weeks Ago

re: Php Drop Down Menu Passing Last Row In Array


Okay, so this is starting to work. The $TVStation variable is echoing back within the loop - where you have
Expand|Select|Wrap|Line Numbers
  1. echo( $_POST['TVStation'.$a] );
Thanks for your help. This is a big step forward.
TheServant's Avatar
Expert
 
Join Date: Feb 2008
Location: Australia
Posts: 919
#10: 3 Weeks Ago

re: Php Drop Down Menu Passing Last Row In Array


No worries, let me know how you go. Once you understand what form of input each function/procedure takes, it will come naturally, and within a month or two, you will look back at this script you're writing and re-do the whole thing more efficiently.
SHOverine's Avatar
Newbie
 
Join Date: Sep 2006
Location: Cleveland, OH
Posts: 18
#11: 3 Weeks Ago

re: Php Drop Down Menu Passing Last Row In Array


I got this to work in its entirety today. My biggest confusion was that I did not know $Variable[#] was an array! Now that I know that, what you were saying makes perfect sense.

You're right, I will go through the code and do some massive cleaning up. This is actually my second time through. The first time was all hard coded tables without looping. It was arduous to deal with.

Thanks again for your help.
TheServant's Avatar
Expert
 
Join Date: Feb 2008
Location: Australia
Posts: 919
#12: 3 Weeks Ago

re: Php Drop Down Menu Passing Last Row In Array


Glad you have it. Hope to see you around Bytes more often, I'm sure we can help speed your understanding and get you teaching others soon ;)
Reply

Tags
array issues, php drop down