Re: More include issues

From: Date: Wed, 06 Jun 2007 20:04:49 +0000
Subject: Re: More include issues
References: 1 2 3 4 5 6 7 8 9 10 11  Groups: php.general 
Request: Send a blank email to php-general+get-256234@lists.php.net to get a copy of this message
Dan Shirah wrote:
<SELECT name="credit_card"> <?php * *** This is the query that uses the inlude file database connection info that is currently returning no results * // Query the credit_card_type table and load all of the records // into an array. echo "Pre-SQL"; **** This does not echo out* $sql = "SELECT * FROM credit_card_code_types ORDER BY credit_card_type_desc"; $res = mssql_query($sql) or die(mssql_error()); echo $sql; **** This does not echo out* echo $res; **** This does not echo out* while ($rec = mssql_fetch_assoc($res)) $credit_card_type_desc[] = $rec; // die('<pre>'.print_r($credit_card_type_code)); * *** No data is returned in the dropdown list* foreach ($credit_card_type_desc as $c) {
    if ($c['credit_card_type_code'] == $_POST['credit_card'])
      echo "<OPTION value=\"{$c['credit_card_type_code']}\" SELECTED>{$c['credit_card_type_desc']}</OPTION>\n";
    else
      echo "<OPTION value=\"{$c['credit_card_type_code']}\">{$c['credit_card_type_desc']}</OPTION>\n"; 
} ?> </SELECT>
Get rid of the echo statements in there - they will really screw up the output of the select box. Alternatively view the source of the page this displays - chances are that the options are being output properly, but the HTML is so messed up that you end up with an empty select box. -Stut

« previous php.general (#256234) next »