Re: Pull Down Menu with ODBC query
| From: | kitfox69 at comcast dot net | Date: | Mon, 11 Aug 2008 21:59:16 +0000 |
| Subject: | Re: Pull Down Menu with ODBC query | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-45202@lists.php.net to get a copy of this message | ||
Thanks everyone for your help so far.
The last two responses I got were great and worked. However I stuck with my original script with
the small $row fix presented earlier and it works great.
The only problem I see with the last two are that there is no scripting to push to the next page
like I have set.
Saying that here is what I currently have:
<?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=sls_his_cust_id>";
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=sls_his_cust_id VALUE=\"Get
Data\"></FORM>";
?>
I need to know how to name the selection so I can push it to the next page using the submit button.
The next page so far is as follows:
<?php
$conn = odbc_connect("HOMES", "", "");
$sls_his_cust_id = $_POST[ 'sls_his_cust_id' ];
$query = ("SELECT sls_his_d2_nam,
cust_phone_no,
cust_phone_no_2,
cust_phone_no_3,
sls_his_invc_no,
sls_his_so_bdat,
sls_his_d2_adrs_1,
sls_his_d2_adrs_2,
sls_his_d2_city,
sls_his_d2_state,
sls_his_d2_zip_cod,
slm_nam,
sls_his_pft_ctr,
sls_his_prchdat_alt
FROM sls_his , cust , slm
where CUST_ID = SLS_HIS_CUST_ID
AND slm = sls_his_slm_1
and sls_his_cust_id = $sls_his_cust_id");
$result = odbc_exec($conn, $query);
odbc_result_all($result)
?>
I need to be able to pass the selected CUSTID on to this page so I can display all the data
pertinent to that customer... also I would like to be able to use the billdate that was present
earlier but am not sure how to push it through again...