RE: Stumped again...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Your code:
while($name = mysql_fetch_row($groups_tmp)) {
  $grp_list .= "<option>$name[0]</option>\n";
}

should be changed to:
while($name = mysql_fetch_row($groups_tmp)) {
  $grp_list .= "<option value=".$name[0].">$name[0]</option>\n";
}

The value property of the option tag is actually what gets submitted to the next page.  The text that immediately follows <option value=x> is what is displayed to the user.

So, for this (HTML) code:
<SELECT NAME=Test>
	<OPTION VALUE=1>Thing One
	<OPTION VALUE=2>Thing Two
</SELECT>

The user would see a list with:
Thing One
Thing Two

The next page would get either 1 or 2 as the value for Test.

-----Original Message-----
From: NIPP, SCOTT V (SBCSI) [mailto:sn4265@sbc.com]
Sent: Tuesday, March 11, 2003 2:43 PM
To: Ben Walling; 'php-db@lists.php.net'
Subject: RE: Stumped again...


	I don't really understand this suggestion.  Could someone possibly
expound on this further?  Maybe an example?  Thanks.

-----Original Message-----
From: Ben Walling [mailto:Ben.Walling@geac.com]
Sent: Tuesday, March 11, 2003 12:19 PM
To: NIPP, SCOTT V (SBCSI)
Subject: Re: Stumped again...


You need the value parameter for the option tags:

<OPTION VALUE=1>First
<OPTION VALUE=2>Second

"Scott V Nipp" <sn4265@sbc.com> wrote in message
news:<F9E3D1712F58D411B70D00508BDF897F077953E4@msgdal07.sbc.com>...
> 	OK...  I have once again thought of something cool to do, and can't
> quite figure out how to make it happen.  I am developing a user account
> request system for work.  Things are coming along nicely.  The user logs
> into the system, kind of, selects the systems that he wants to have
accounts
> added on, and then the next page is where the problems begin.  Once the
user
> selects the systems, the next page lists the systems selected along with a
> dropdown for "Default Shell" and another dropdown for "Primary Group" and
a
> small text box for "Other Group".  The dropdowns are populating fine, and
> everything is displaying on the screen as expected.  The problem I am
having
> is that the selections don't seem to work.  I have this page feed a final
> page that also displays the selections as a result test.  I am seeing the
> system names, but no shell or group information.  
> 	Here are some pertinent portions of the code with comments:
> 
> <<  Above code snipped  >>
> $shell_list = getEnumOptions('accounts','shell');
> $shell_tmp = "<select size=\"1\" name=\"shell\">\n";
> $shell_tmp .= "<option>Default Shell</option>\n";
> foreach ($shell_list as $item) {
>   $shell_tmp .= "<option>$item</option>\n";
> }
> $shell_tmp .= "</select>\n";
> 
> mysql_select_db($database, $Prod);
> $query_groups = "SELECT name FROM grps";
> $groups_tmp = mysql_query($query_groups, $Prod) or die(mysql_error());
> $grp_list = "<select size=\"1\" name=\"grp\">\n";
> $grp_list .= "<option>Primary Group</option>\n";
> $grp_list .= "<option>-----------</option>\n";
> while($name = mysql_fetch_row($groups_tmp)) {
>   $grp_list .= "<option>$name[0]</option>\n";
> }
> $grp_list .= "</select>\n";
> <<  Code snipped  >>
> 
> 	This section of code creates the "Default Shell" dropdown list and
> the "Primary Group" dropdown list.  One of these lists is derived from the
> ENUM values of the field, the other is derived from the values of a
seperate
> table.
> 
> <<  Code snipped  >>
> <form name="form1" method="post" action="account_final.php">
> 
> <?php
>   while (isset($_POST['system'][$a])) { 
>    	echo "<td width=\"20%\"><div
> align=\"center\">".$_POST['system'][$a]."</div></td>";
> 	echo "<td width=\"20%\"><div
> align=\"center\">".$shell_tmp."</div></td>";
> 	echo "<td width=\"20%\"><div
> align=\"center\">".$grp_list."</div></td>";
> 	echo "<td width=\"20%\"><div align=\"center\"><input type=\"text\"
> name=\"other\" value=\"\" size=\"15\"></div></td></tr>";
> 	$tmp = $sbcuid."-".$_POST['system'][$a];
> 	$a++;
> 	array_push( $accnts, $tmp );
>             array_push( $shells, $shell );
>             array_push( $grps, $grp );
>             array_push( $others, $other );
>  }
> ?>
> <<  Code snipped  >>
> 
> 	This section of code actually displays one line for each system
> previously selected with additional input items for "Default Shell",
> "Primary Group", and "Other Group".  This code also creates arrays of the
> systems, shells, groups, and others which are passed onto the next page.
> This system array is used to display the results as well as populate the
> database, and the system array data is the only data actually being
> displayed.  I do not think that the data for the other arrays is actually
> getting populated.
> 
> <<  Code snipped  >>
> <?php
>   session_register("accnts", "shells", "grps", "others");
> ?>
> 
> <div align="center">
>     <input type="submit" name="Submit" value="Submit">
> </div>
> </form>
> <<  Code snipped  >>
> 
> 	This section of code simply registers the arrays for use on the next
> page.
> 
> 	Thanks in advance for any help.  Please let me know if you need any
> other information to help figure out what is wrong with this.
> 
> Scott Nipp
> Phone:  (214) 858-1289
> E-mail:  sn4265@sbc.com
> Web:  http:\\ldsa.sbcld.sbc.com
> 
> 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux