disapearing variables that reappear on REFRESH
Posted: Tue Jun 22, 2004 2:58 pm
I'm working with a multi-page form using Dreamweaver, php and a php/mysql database. Everything works fine--transfering data from one page to the next except for 2 pages. Every now and then the passed variables don't show up on the page....until I do a page refresh, then the data shows up. It doesn't happen every time and seems very random to when it occurs. Can anyone explain this? or suggestions to cause?
Code: Select all
<?php
session_start();
?>
<?php
//Connection statement
require_once('Connections/conn_schedules.php');
//Aditional Functions
require_once('includes/functions.inc.php');
// build the form action
$editFormAction = $HTTP_SERVER_VARS['PHP_SELF'] . (isset($HTTP_SERVER_VARS['QUERY_STRING']) ? "?" . $HTTP_SERVER_VARS['QUERY_STRING'] : "");
if ((isset($HTTP_POST_VARS["MM_insert"])) && ($HTTP_POST_VARS["MM_insert"] == "form1")) {
$insertSQL = sprintf("INSERT INTO class_register (catagory, `class`, location_long, start_date, salutation, first_name, last_name, job_title, department, mailstop, company, address, po_box, city, `state`, zip, country, w_phone, ext, fax, email, voucher, price, `value`, comments, other_time, payment_type, po_num, cc_name, cc_num, cc_expdate, total_due, regdate, cc_type2) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($HTTP_POST_VARS['catagory'], "text"),
GetSQLValueString($HTTP_POST_VARS['class'], "text"),
GetSQLValueString($HTTP_POST_VARS['location_long'], "text"),
GetSQLValueString($HTTP_POST_VARS['start_date'], "text"),
GetSQLValueString($HTTP_POST_VARS['salutation'], "text"),
GetSQLValueString($HTTP_POST_VARS['first_name'], "text"),
GetSQLValueString($HTTP_POST_VARS['last_name'], "text"),
GetSQLValueString($HTTP_POST_VARS['job_title'], "text"),
GetSQLValueString($HTTP_POST_VARS['department'], "text"),
GetSQLValueString($HTTP_POST_VARS['mailstop'], "text"),
GetSQLValueString($HTTP_POST_VARS['company'], "text"),
GetSQLValueString($HTTP_POST_VARS['address'], "text"),
GetSQLValueString($HTTP_POST_VARS['po_box'], "text"),
GetSQLValueString($HTTP_POST_VARS['city'], "text"),
GetSQLValueString($HTTP_POST_VARS['state'], "text"),
GetSQLValueString($HTTP_POST_VARS['zip'], "text"),
GetSQLValueString($HTTP_POST_VARS['country'], "text"),
GetSQLValueString($HTTP_POST_VARS['w_phone'], "text"),
GetSQLValueString($HTTP_POST_VARS['ext'], "text"),
GetSQLValueString($HTTP_POST_VARS['fax'], "text"),
GetSQLValueString($HTTP_POST_VARS['email'], "text"),
GetSQLValueString($HTTP_POST_VARS['voucher'], "text"),
GetSQLValueString($HTTP_POST_VARS['price'], "text"),
GetSQLValueString($HTTP_POST_VARS['value'], "text"),
GetSQLValueString($HTTP_POST_VARS['comments'], "text"),
GetSQLValueString($HTTP_POST_VARS['other_time'], "text"),
GetSQLValueString($HTTP_POST_VARS['payment_type'], "text"),
GetSQLValueString($HTTP_POST_VARS['po_num'], "text"),
GetSQLValueString($HTTP_POST_VARS['cc_name'], "text"),
GetSQLValueString($HTTP_POST_VARS['cc_num'], "text"),
GetSQLValueString($HTTP_POST_VARS['cc_expdate'], "text"),
GetSQLValueString($HTTP_POST_VARS['total_due'], "text"),
GetSQLValueString($HTTP_POST_VARS['regdate'], "text"),
GetSQLValueString($HTTP_POST_VARS['cc_type2'], "text"));
$Result1 = $conn_schedules->Execute($insertSQL) or die($conn_schedules->ErrorMsg());
$insertGoTo = "https://lepton.liquidweb.com/~gb-solut/04_reg_thanks3.php";
if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $HTTP_SERVER_VARS['QUERY_STRING'];
}
KT_redir($insertGoTo);
}
// begin Recordset
$colname__rs_values = '-1';
if (isset($HTTP_POST_VARS['voucher'])) {
$colname__rs_values = $HTTP_POST_VARS['voucher'];
}
$query_rs_values = sprintf("SELECT * FROM voucher_types WHERE number = '%s'", $colname__rs_values);
$rs_values = $conn_schedules->SelectLimit($query_rs_values) or die($conn_schedules->ErrorMsg());
$totalRows_rs_values = $rs_values->RecordCount();
// end Recordset
// begin Recordset
$query_rs_regdate = "SELECT * FROM class_register";
$rs_regdate = $conn_schedules->SelectLimit($query_rs_regdate) or die($conn_schedules->ErrorMsg());
$totalRows_rs_regdate = $rs_regdate->RecordCount();
// end Recordset
//PHP ADODB document - made with PHAkt 2.7.5
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#FFFFFF">
<table width="600" cellspacing="0" cellpadding="5" border="0" bgcolor="#EEEEEE">
<tr bgcolor="#4242C4">
<td colspan="2"><h2><span class="style7">Global Business Solutions, Inc </span></h2></td>
</tr>
<tr>
<td> </td>
<td align="right" valign="top"><span class="style9">For immediate assistance please call: TOLL FREE: 877-446-4274 </span></td>
</tr>
<tr>
<td bgcolor="#FFFFFF" colspan="2" height="10"></td>
</tr>
<tr>
<td colspan=2>
<table width="674" border="0" align="center" cellpadding="4" cellspacing="0">
<tr>
<th width="652" height="90%" valign="middle" bgcolor="#4242C4" scope="col"><h3 align="left" class="style10 style7">Course Registration </h3>
</th>
</tr>
<tr>
<th class="style4" scope="row"><p><a href="http://www.gb-solutions.com/04_Schedules.php">Return to Schedule/Start Registration Over</a> <br><br>
<span class="style1"><span class="style34 style8">NOTE: if your information does not show up here REFRESH page</span></span></p>
<form action="<?php echo $editFormAction; ?>" method="POST" name="form1">
<table width="652" border="0" cellspacing="0" cellpadding="3">
<tr>
<th width="16" scope="col"><div align="right"></div></th>
<th width="521" scope="col"><div align="left">Subject:</span> <?php echo $_POST['catagory']; ?></span></div></th>
<th width="88" rowspan="11" bgcolor="#9492F3" scope="col"> </th>
</tr>
<tr>
<th scope="row"><div align="right"><img src="wordSpacer.gif" width="15" height="8"></div></th>
<td><div align="left" class="content"><strong>Course: <span class="style24"><strong><?php echo $_POST['class']; ?></strong></span></strong></div></td>
</tr>
<tr>
<th scope="row"><div align="right"><img src="wordSpacer.gif" width="15" height="8"></div></th>
<td><div align="left" class="content"><strong>Location: <?php echo $_POST['location_long']; ?></strong></div></td>
</tr>
<tr>
<th scope="row"> </th>
<td><span class="content"><strong>Date: <strong><?php echo $_POST['start_date']; ?></strong></span></td>
</tr>
<tr>
<th scope="row"> </th>
<td><strong>Time:<span class="content"><strong> <?php echo $_POST['other_time']; ?></strong></span></td>
</tr>
<tr>
<th scope="row"> </th>
<td><span class="content"><strong>Information: completed </strong></span></td>
</tr>
<tr>
<th scope="row"> </th>
<td><span class="style27">Course Price: $<span class="content"><strong><?php echo $_POST['price']; ?></strong></span></span></td>
</tr>
<tr>
<th scope="row"> </th>
<td><span class="style31">Voucher/Coupon Number:<span class="style27"><strong><span class="content"><strong><strong> <?php echo $_POST['voucher']; ?></strong></strong></span></strong></span> </span></span></td>
</tr>
<tr>
<th width="16" scope="row"><div align="right"><img src="arrow_r.gif" width="7" height="7"></div></th>
<td><div align="left" class="content"><strong>Payment:<span class="style7">
<?php
//this defines the session variables I want to send to the thank you page (after everything has been submitted to
//database) so they will show up on page AND in the html student and admin email templates---Lynne
$_SESSION[first_name] = "$first_name";
$first_name=$_POST['first_name'];
$_SESSION[last_name] = "$last_name";
$last_name=$_POST['last_name'];
$_SESSION[email] = "$email";
$email=$_POST['email'];
$_SESSION[catagory] = "$catagory";
$catagory=$_POST['catagory'];
$_SESSION[classname] = "$class";
$class=$_POST['class'];
$_SESSION[location_long] = "$location_long";
$location_long=$_POST['location_long'];
$_SESSION[start_date] = "$start_date";
$start_date=$_POST['start_date'];
$_SESSION[other_time] = "$other_time";
$other_time=$_POST['other_time'];
$_SESSION[price] = "$price";
$price=$_POST['price'];
$_SESSION[voucher] = "$voucher";
$voucher=$_POST['voucher'];
?></span> </strong></div></td>
</tr>
<tr>
<th scope="row"><div align="right"><img src="wordSpacer.gif" width="15" height="8"></div></th>
<td><div align="left">
<table width="430" border="0" cellspacing="0" cellpadding="1">
<tr>
<th width="182" scope="col"><div align="right" class="style4 style19"></div></th>
<th width="244" scope="col"><div align="left"><img src="NEWassets/wordSpacer.gif" width="15" height="8"> </div></th>
</tr>
<tr bgcolor="#FFE8E8">
<th scope="row"><div align="right">Course Total:</div></th>
<td> <img src="NEWassets/wordSpacer.gif" width="22" height="8">$<span class="content"><strong><?php echo $_POST['price']; ?></strong></span></td>
</tr>
<tr bgcolor="#FFE8E8">
<th scope="row"><div align="right">Voucher/Coupon Value: </div></th>
<td><img src="NEWassets/wordSpacer.gif" width="18" height="8"><strong>-$<?php echo $rs_values->Fields('value'); ?></strong></td>
</tr>
<tr bgcolor="#FF0000">
<th bgcolor="#FFA6A6" scope="row"><div align="right" class="style29">Total Payment Due:</div></th>
<td bgcolor="#FFA6A6"><img src="NEWassets/wordSpacer.gif" width="15" height="8"><span class="style29">=$<span class="style1">
<?php
$_SESSION[total_due] = "$total_due";
$firstnum=$_POST['price']; //this number is coming from the previous page as a URL variable
$secondnum=$rs_values->Fields('value'); //this number is coming from the recordset on this page
$total_due=$firstnum - $secondnum;
print "$total_due";
?>
</span></span></span></td>
</tr>
<tr>
<th colspan="2" scope="row"><span class="style28">If Total Due is <u>$0</u>, skip rest of form and proceed to NEXT BUTTON below. <br>
For payment of any balance fill out form below. </span></th>
</tr>
<tr>
<th colspan="2" bgcolor="#4242C4" scope="row"><span class="style25 style7">Payment Balance </span></th>
</tr>
<tr>
<th scope="row"><div align="right" class="style20">Select Payment Type: </div></th>
<td><div align="left">
<select name="payment_type" id="payment_type">
<option disabled>--Select--</option>
<option value="Credit Card">Credit Card</option>
<option value="PO Number">PO Number</option>
</select>
</div></td>
</tr>
<tr bgcolor="#EEEEEE">
<th colspan="2" scope="row"><span class="style33">PO Information </span></th>
</tr>
<tr>
<th scope="row"><div align="right" class="style20">PO Number: </div></th>
<td><div align="left">
<input name="po_num" id="po_num" size="40">
</div></td>
</tr>
<tr bgcolor="#EEEEEE">
<td colspan="2" scope="row"><div align="right" class="style20"></div>
<div align="center" class="style32">Credit Card Information</div></td>
</tr>
<tr>
<td scope="row"><div align="right" class="style20"><strong>Credit Card Type:</strong></div></td>
<td><div align="left">
<select name="cc_type2" id="cc_type2">
<option disabled>--Select--</option>
<option value="VISA">VISA</option>
<option value="MASTERCARD">MASTERCARD</option>
<option value="AMERICAN EXPRESS">AMERICAN EXPRESS</option>
</select>
</div></td>
</tr>
<tr>
<td scope="row"><div align="right" class="style26"><strong>Name on Card:</strong></div></td>
<td><div align="left">
<input name="cc_name" id="cc_name" size="40">
</div></td>
</tr>
<tr>
<th scope="row"><div align="right" class="style20">Card Number:</div></th>
<td><div align="left">
<input name="cc_num" id="cc_num" size="40">
</div></td>
</tr>
<tr>
<th scope="row"><div align="right" class="style20">Card Expiration Date:</div></th>
<td><div align="left">
<input name="cc_expdate" id="cc_expdate" size="40">
</div></td>
</tr>
<tr>
<td scope="row"><div align="right" class="style20"></div></td>
<td><div align="left">
</div></td>
</tr>
</table>
<span class="style1">
</span> </div></td>
</tr>
<tr>
<th scope="row"><div align="right"><img src="wordSpacer.gif" width="15" height="8"></div></th>
<td bgcolor="#FF0000">
<div align="center">
<input name="Submit" type="submit" value="Submit Registration">
<span class="style1"><img src="arrow_l.gif" width="7" height="7" align="absmiddle">
<span class="style7"><span class="style29">
</span></span>
<input name="catagory" type="hidden" id="catagory" value="<?php echo $HTTP_POST_VARS['catagory']; ?>">
<input name="class" type="hidden" id="class" value="<?php echo $HTTP_POST_VARS['class']; ?>">
<input name="location_long" type="hidden" id="location_long" value="<?php echo $HTTP_POST_VARS['location_long']; ?>">
<input name="start_date" type="hidden" id="start_date" value="<?php echo $HTTP_POST_VARS['start_date']; ?>">
<input name="salutation" type="hidden" id="salutation" value="<?php echo $HTTP_POST_VARS['salutation']; ?>">
<input name="first_name" type="hidden" id="first_name" value="<?php echo $HTTP_POST_VARS['first_name']; ?>">
<input name="last_name" type="hidden" id="last_name" value="<?php echo $HTTP_POST_VARS['last_name']; ?>">
<input name="job_title" type="hidden" id="job_title" value="<?php echo $HTTP_POST_VARS['job_title']; ?>">
<input name="department" type="hidden" id="department" value="<?php echo $HTTP_POST_VARS['department']; ?>">
<input name="mailstop" type="hidden" id="mailstop" value="<?php echo $HTTP_POST_VARS['mailstop']; ?>">
<input name="company" type="hidden" id="company" value="<?php echo $HTTP_POST_VARS['company']; ?>">
<input name="address" type="hidden" id="address" value="<?php echo $HTTP_POST_VARS['address']; ?>">
<input name="po_box" type="hidden" id="po_box" value="<?php echo $HTTP_POST_VARS['po_box']; ?>">
<input name="city" type="hidden" id="city" value="<?php echo $HTTP_POST_VARS['city']; ?>">
<input name="state" type="hidden" id="state" value="<?php echo $HTTP_POST_VARS['state']; ?>">
<input name="zip" type="hidden" id="zip" value="<?php echo $HTTP_POST_VARS['zip']; ?>">
<input name="country" type="hidden" id="country" value="<?php echo $HTTP_POST_VARS['country']; ?>">
<input name="w_phone" type="hidden" id="w_phone" value="<?php echo $HTTP_POST_VARS['w_phone']; ?>">
<input name="ext" type="hidden" id="ext" value="<?php echo $HTTP_POST_VARS['ext']; ?>">
<input name="fax" type="hidden" id="fax" value="<?php echo $HTTP_POST_VARS['fax']; ?>">
<input name="comments" type="hidden" id="comments" value="<?php echo $HTTP_POST_VARS['comments']; ?>">
<input name="email" type="hidden" id="email" value="<?php echo $HTTP_POST_VARS['email']; ?>">
<input name="other_time" type="hidden" id="other_time" value="<?php echo $HTTP_POST_VARS['other_time']; ?>">
<input name="voucher" type="hidden" id="voucher" value="<?php echo $HTTP_POST_VARS['voucher']; ?>">
<input name="value" type="hidden" id="value" value="<?php echo $rs_values->Fields('value'); ?>">
<input name="price" type="hidden" id="price" value="<?php echo $HTTP_POST_VARS['price']; ?>">
<input name="total_due" type="hidden" id="total_due" value="<?php echo $HTTP_POST_VARS['total_due']; ?>">
<input name="regdate" type="hidden" id="regdate" value="<?php echo $rs_regdate->Fields('regdate'); ?>">
<span class="style7"><span class="style29">
</span></span> </span></div></td>
</tr>
</table>
<input type="hidden" name="MM_insert" value="form1">
</form>
<p class="style7"><span class="style29">
</span></p></th>
</tr>
<tr>
<th bgcolor="#4242C4" scope="row"> </th>
</tr>
</table>
<div align="center"></div>
</form> </td>
</tr>
<tr>
<td bgcolor="#FFFFFF" colspan="2" height="10"></td>
</tr>
</table>
</body>
</html>
<?php
$rs_values->Close();
$rs_regdate->Close();
?>