I want to be able to pass these two variables to the iframe so that they can be used in the Insert statement of the iframe source page and be written to the database tables.
Here are the codes:
getcustid5:
updnps1.php:
I view the pagesource when getcustid5 is loaded in forefox and can see that the variables are not being shown in the url for the iframe src. All I need it to do is show what the selected billdate and custid are for getcustid5 the last time it is called to display the data.
I am pretty sure the updnps.php is fine as it parses and returns the thanks print but it does not run the query as billdate is not set from not getting the variable.
Here are the codes:
getcustid5:
Code:
<?php
print('<iframe align="right"
src ="updnps1.php?billdate=' . $billdate . '&custid=' . $sls_his_cust_id . '"
height="550"
width="36%">
</iframe>');
$conn = odbc_connect("HOMES", "", "");
if (!empty($_POST['billdate'])){
$billdate = $_POST[ 'billdate' ];
$query = "SELECT DISTINCT sls_his_cust_id FROM sls_his where sls_his_prchdat_alt = $billdate";
$result = odbc_exec($conn, $query);
$options = '';
while($row = odbc_fetch_array($result)){
$options .= "\t\t<option value=\"{$row[sls_his_cust_id]}\">{$row[sls_his_cust_id]}</OPTION>\r\n";
}
echo <<<HTML
<form method="post" action="getcustid5.php">
<div>
<select name="sls_his_cust_id">
{$options}
</select>
<input type="submit" name="custid" value="Get Data">
<input type="hidden" name="billdate"value="$billdate" />
</div>
</FORM>
HTML;
}
if (isset($_POST['custid'])) {
$sls_his_cust_id = $_POST['sls_his_cust_id'];
}
$query1 = ("SELECT DISTINCT sls_his_cust_id as 'Customer ID',
sls_his_d2_nam as 'Customer Name',
cust_phone_no as 'Phone Number 1',
cust_phone_no_2 as 'Phone Number 2',
cust_phone_no_3 as 'Phone Number 3'
FROM sls_his , cust
where CUST_ID = SLS_HIS_CUST_ID
and sls_his_cust_id = '$sls_his_cust_id'");
$query2 = ("SELECT DISTINCT sls_his_pft_ctr as 'Profit Center',
UPPER(slm_nam) as 'Sales Person'
FROM sls_his, slm
where sls_his_slm_1 = slm
and sls_his_cust_id = '$sls_his_cust_id'");
$query3 = ("SELECT sls_his_item_id as 'Item ID',
sum(sls_his_qty_sld) as 'Quantity Sold',
sls_his_prchdat_alt as 'Billed Date',
sls_his_del_via as 'Ship Via'
FROM sls_his
where sls_his_cust_id = '$sls_his_cust_id'
Group by sls_his_item_id, sls_his_prchdat_alt, sls_his_del_via
Order by sls_his_prchdat_alt DESC");
$result1 = odbc_exec($conn, $query1);
$result2 = odbc_exec($conn, $query2);
$result3 = odbc_exec($conn, $query3);
?>
</BR>
<?php
odbc_result_all($result1)
?>
</BR>
<?php
odbc_result_all($result2)
?>
</BR>
<?php
odbc_result_all($result3)
?>
updnps1.php:
Code:
<?php echo $_GET[ 'billdate' ];
echo $_GET[ 'custid' ];
?>
<form action="updnps.php" method="post"
<p> First Attempt</p>
<input type="radio" name="ans1" value="1"> Answer
</BR>
<input type="radio" name="ans1" value="0"> NoAnswer
</BR>
<p> NPS SCORE</p>
<select name="nps">
<option value="0">0</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="10">10</option>
</select>
</BR>
<p> CUSTOMER COMMENTS</p>
<textarea rows="4" cols="40" name="comments1"></textarea>
</BR>
<p> USER COMMENTS</p>
<textarea rows="4" cols="40" name="comments2"></textarea>
</BR>
<p> EMAIL</p>
<input type="text" name="email" /></label>
</BR>
<input type="submit" value="GO" />
</form>
</body>
</html>
I view the pagesource when getcustid5 is loaded in forefox and can see that the variables are not being shown in the url for the iframe src. All I need it to do is show what the selected billdate and custid are for getcustid5 the last time it is called to display the data.
I am pretty sure the updnps.php is fine as it parses and returns the thanks print but it does not run the query as billdate is not set from not getting the variable.