Re: stuck

From: Date: Fri, 17 Aug 2001 16:31:29 +0000
Subject: Re: stuck
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-63207@lists.php.net to get a copy of this message
I'm not 100% sure what you want to accomplish here, or why it is stuck on the last row, but I've made some observations. On Friday 17 August 2001 09:05 am, you wrote: <? > 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"); ->Session register variables that were supposed to have been passed by a form. For a piece of test code you may want to execute this to see what variables and values were passed. I think only UID and company have been passed via the uid select. echo '<pre>From variables were:<BR>', print_r($HTTP_POST_VARS), '</pre>'; > > 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>"; > } ->Here you've requested a bunch of info back from your query, but you only use uid and company in the option form, so you never actually pass the other info back to be registered by the session in your first lines. You could simplify with: $option_block = NULL; while ($row = mysql_fetch_array($result)) { $option_block .= '<option value="'.$row['uid'].'">'.$row['company']. '</option>'; } you may also want to do an echo in this block, or examine your html source to make sure you are getting back the values you request, and make sure that uid is unique to each row. ...if you need the other info you may want to do a query for it after the UID and company have been passed via the form on the second iteration, and then sess register them.

« previous php.general (#63207) next »