stuck

From: Date: Fri, 17 Aug 2001 16:05:11 +0000
Subject: stuck
Groups: php.general 
Request: Send a blank email to php-general+get-63201@lists.php.net to get a copy of this message
Hi, Can someone please tell me what is wrong with this page. The problem is that my option block is always stuck on the last record in the table. No matter what option I choose, the information, address, city, state...etc, that is passed is always the one of the last record in the table...Help! <? session_start(); session_register("address"); session_register("city"); session_register("state"); session_register("zip_code"); session_register("country"); session_register("company"); session_register("occupation"); session_register("telephone"); session_register("fax"); $db_name = "contact"; $table_name = "company"; $connection = @mysql_connect("l", "c", "c") or die("Couldn't connect."); $db = @mysql_select_db($db_name, $connection) or die("Couldn't select database."); $sql = "SELECT * FROM $table_name "; $result = @mysql_query($sql,$connection) or die("Couldn't execute query."); while ($row = mysql_fetch_array($result)) { $uid = $row['uid']; $address = $row['address']; $city = $row['city']; $state = $row['state']; $zip_code = $row['zip_code']; $country = $row['country']; $company = $row['company']; $occupation = $row['occupation']; $telephone = $row['telephone']; $fax = $row['fax']; $option_block .= "<option value=\"$uid\">$company</option>"; } $display_block = " <FORM METHOD=post ACTION=show_adduserbycompany.php> <P><strong>Company:</strong> <select name=\"uid\"> $option_block </select> <INPUT TYPE=\"SUBMIT\" NAME=\"submit\" VALUE=\"Select this Company\"></P> </form> "; ?> <HTML> <HEAD> <TITLE>User Information: Add a User</TITLE> </HEAD> <BODY> <h1> User Information</h1> <h2><em>Add a User</em></h2> <P>Select a company from the list below, to continue to the user addition.</p> <? echo "$display_block"; ?> <p><a href="contact_menu.php">Return to Main Menu</a></p> </BODY> </HTML>

« previous php.general (#63201) next »