First, thanks in advance to anyone who is able to assist me.
I'm a newbie to PHP; this is my first APP. (I normally use ColdFusion to develop a web app -- if you know of any sites or books that provide the PHP equivalent syntax/tags/etc. to Coldfusion, please let me know. Trying to make my transition a little easier. )
The problem I am having is, that the select box displays ONLY the selected value within an existing record; it doesn't display ALL the values (i.e. to allow the user to change his/her previous selection) along with his/her original selected value.
Not sure what I have wrong ... did some research across various forums, but have yet to find a resolution.
Again, any assistance is greatly appreciated!
Thanks,
Nicole
I'm a newbie to PHP; this is my first APP. (I normally use ColdFusion to develop a web app -- if you know of any sites or books that provide the PHP equivalent syntax/tags/etc. to Coldfusion, please let me know. Trying to make my transition a little easier. )
The problem I am having is, that the select box displays ONLY the selected value within an existing record; it doesn't display ALL the values (i.e. to allow the user to change his/her previous selection) along with his/her original selected value.
Not sure what I have wrong ... did some research across various forums, but have yet to find a resolution.
Code:
...within top portion of page
//retrieve the data from the database
//odbc_fetch_row: Fetch a row
while(@odbc_fetch_row($qryresult))
{
$intCompany = odbc_result($qryresult, "intCompany");
...
}
Code:
<tr>
<td class="rowlbl">Company</td>
<td><select name="intCompany">
<option value="">
<?
//the SQL statement that will query the database
$qryCompany = "select * from tblCompany order by txtCompany ASC";
//perform the query
//odbc_exec: Prepare and execute a SQL statement
$qrycompanyresult=odbc_exec($conn, $qryCompany);
//retrieve the data from the database
//odbc_fetch_row: Fetch a row
while(@odbc_fetch_row($qrycompanyresult)){
//odbc_result: Get result data
$ctrCompany = odbc_result($qrycompanyresult, "ctrCompany");
$txtCompany = odbc_result($qrycompanyresult, "txtCompany");
if(!$_GET[ctrCandidate]){
//new record
echo "<option value=\"$ctrCompany\">$txtCompany</option>";
} else {
//existing record
if($intCompany == $ctrCompany) {
echo "<option value=\"$ctrCompany\" SELECTED>$txtCompany</option>";
}
}
}
?>
</select>
</td>
</tr>
Again, any assistance is greatly appreciated!
Thanks,
Nicole