RE: [PHP-DB] Pull Down Menu with ODBC query
| From: | kitfox69 at comcast dot net | Date: | Mon, 11 Aug 2008 20:42:49 +0000 |
| Subject: | RE: [PHP-DB] Pull Down Menu with ODBC query | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-45200@lists.php.net to get a copy of this message | ||
BTW I want to make sure I am doing this correctly...
with that current script (edited below with your fix) will I be able to pass that selection on into
a further PHP page? I do not see how without assigning a variable to it and passing it with POST...
how would I go about this?
-------------- Original message ----------------------
From: "Simcha" <simcha@syounger.com>
>
> odbc_fetch_array() returns an associative array, so will you need to use
> $row[' sls_his_cust_id'] instead of $row[0].
>
>
>
> -----Original Message-----
> From: kitfox69@comcast.net [mailto:kitfox69@comcast.net]
> Sent: Monday, August 11, 2008 10:14 PM
> To: php-db@lists.php.net
> Subject: [PHP-DB] Pull Down Menu with ODBC query
>
> I am having trouble getting this script to populate the query data into a
> pull down menu.
>
> The SQL script works fine and displays the data with odbc_result_all but
> will not put it in the menu.
>
> Script is as follows:
>
> <?php
> $conn = odbc_connect("HOMES", "", "");
> $billdate = $_POST[ 'billdate' ];
> $query = ("SELECT DISTINCT sls_his_cust_id FROM sls_his where
> sls_his_prchdat_alt = $billdate");
> $result = odbc_exec($conn, $query);
>
> echo "<FORM method=POST action=getcustdata.php>";
> echo "<SELECT name=column_name>";
> while($row = @odbc_fetch_array($result))
> {
> echo "<OPTION
> VALUE=\"$row[sls_his_cust_id]\">$row[sls_his_cust_id]</OPTION>";
> }
> echo "</SELECT><INPUT TYPE=submit name=submit VALUE=\"Get
> Results\"></FORM>";
> ?>
>
> Any ideas?
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
> No virus found in this incoming message.
> Checked by AVG - http://www.avg.com
> Version: 8.0.138 / Virus Database: 270.6.0/1604 - Release Date: 11/08/2008
> 05:50
>