Re: More include issues

From: Date: Wed, 06 Jun 2007 19:58:40 +0000
Subject: Re: More include issues
References: 1 2 3 4 5 6 7 8 9 10  Groups: php.general 
Request: Send a blank email to php-general+get-256231@lists.php.net to get a copy of this message
Okay, here's the entire thing: <body> <div align="center">
    <h3>Submit a New Payment.</h3>
</div> <?php include '../../Conn/prpr_mssql.php'; ****The echo in this include displays* include '../../Conn/prpr_common.php'; ****The echo in this include displays *$max_id = $_POST['max_id']; ?> <form name="inputForm" action="" method="post" enctype="multipart/form-data"> <input type="hidden" name="max_id" value="<?php echo $max_id; ?>"> <?php if(!empty($_POST['max_id'])) { **** For this test, max_id is empty* } else { ?> <table align="center" border="0" cellpadding="0" cellspacing="0" width="680"> <tr> <td height="13" align="center" class="tblhead"><strong>Credit Card Information</strong></td> </tr> <tr>
      <td colspan="6"><hr color="#006600"></td>
</tr> <tr> <td width="100%" class="cellbk1"> <table border="0" cellpadding="2" cellspacing="1" width="100%" height="100%">
           </table>
</td> </tr> <tr> <td width="100%" class="cellbk1"> <table border="0" cellpadding="2" cellspacing="1" width="100%" height="100%"> <tr>
    <TD CLASS="CELLBK2">
     <table border="0" cellpadding="2" cellspacing="1">
             <tr>
               <td width="129" height="42" align="left">
                 <div align="right">Is it a debit card?</div></td>
               <td width="112"><input type="radio" name="debit_card"
value="Y">
                 <span class="small">Yes</span> <input type="Radio"
name="debit_card" value="N">
                 <span class="small">No</span> </td>
               <td width="138" align="right"><div align="right"><a
href="javascript:CCTYPEhelp();" class="med">Credit Card Type:</a></div></td>
               <td width="274" align="left" class="tblcell_sm">
<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> </td>
             </tr>
</table> </table> On 6/6/07, Stut <stuttle@gmail.com> wrote:
You can't rely on everyone seeing the different colours in your text. Please lay out your replies so they can be read in plain text. Dan Shirah wrote: Ok, I can't see anything wrong with that. Me either Are you absolutely sure it works when you replace the include line with the contents of the include file? Are you sure you're replacing it exactly? Yes, because when I originally made the form I had the connection info hard coded. I "cut" the info from the form and pasted it into the newly created include file. One minor thing... that include file is not the same path and filename you gave in your original post. You are looking at the right piece of code yes? Yeah, in my previous post I changed the folder/file name just to be safe, but I forgot to do it before posting this one. One thing I'd suggest you add is a check after the mssql_query to see how many rows were returned. Beyond that I'm stumped. Something must be different. Assuming none of these files are being used inside a function or class the act of simply moving code out to an included file should not affect its operation. -Stut


« previous php.general (#256231) next »