Copy link to clipboard
Copied
hi,
i am using dreamweaver cs4, mysql and php .
i created a form page a year or more ago, which has worked well using the present mysql and php versions. what i am currently doing is building a new site based around simple machines forum. this will include converting my previous pages which will access the smf_members (and other) tables in the mysql db. these worked correctly using the previous phpbb3 db.
my problem is that i cannot seem to nail the code correctly. i have it so that the db info for the user is called correctly, but when sending the updated information through the form, it empties every field in the update query.
the code below is a work in progress, but is at the stage where the user info appears, but the update empties the fields.
can someone please have a look at why this should be so?
thanks
<?php
require("/path/to/SSI.php");
// We're going to want a few globals... these are all set later.
global $time_start, $maintenance, $msubject, $mmessage, $mbname, $language;
global $boardurl, $boarddir, $sourcedir, $webmaster_email, $cookiename;
global $db_server, $db_name, $db_user, $db_prefix, $db_persist, $db_error_send, $db_last_error;
global $db_connection, $modSettings, $context, $sc, $user_info, $topic, $board, $txt;
global $smcFunc, $ssi_db_user, $scripturl, $ssi_db_passwd, $db_passwd, $cachedir;
$pagetitle = 'Volunteer Information Form';
$userid = $context['user']['id'];
?>
<?php require_once('../Connections/mirrorfoundation.php'); ?>
<?php
template_html_above();
template_body_above();
?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
$editFormAction = $HTTP_SERVER_VARS['PHP_SELF'];
if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
$editFormAction .= "?" . $HTTP_SERVER_VARS['QUERY_STRING'];
}
if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form1")) {
$updateSQL = sprintf("UPDATE smf_members SET email_address=%s, M_first_name=%s, M_last_name=%s, M_country=%s, M_nationality=%s, M_gender=%s, dob=%s, flightarrival=%s, flight=%s, M_passport_number=%s, passportexpiry=%s, M_passport_issuing_authority=%s, M_visatype=%s, M_visa_number=%s, M_issue_date=%s, M_visaexpiry=%s, M_tm6=%s, M_visacheckpoint=%s, M_emergency_contact_name=%s, M_emergency_contact_number=%s, M_emergency_contact_email=%s, M_dietary_requirements=%s, M_dietary_notes=%s, M_medical_conditions=%s, M_medical_notes=%s, M_timestamp=%s, M_insurance_company=%s, M_insurance_policynumber=%s, M_insurance_expirydate=%s, M_ipaddress=%s WHERE id_member = $userid",
GetSQLValueString($HTTP_POST_VARS['email_address'], "text"),
GetSQLValueString($HTTP_POST_VARS['M_first_name'], "text"),
GetSQLValueString($HTTP_POST_VARS['M_last_name'], "text"),
GetSQLValueString($HTTP_POST_VARS['M_country'], "text"),
GetSQLValueString($HTTP_POST_VARS['M_nationality'], "text"),
GetSQLValueString($HTTP_POST_VARS['M_gender'], "text"),
GetSQLValueString($HTTP_POST_VARS['dob'], "date"),
GetSQLValueString($HTTP_POST_VARS['flightarrival'], "date"),
GetSQLValueString($HTTP_POST_VARS['flight'], "text"),
GetSQLValueString($HTTP_POST_VARS['M_passport_number'], "text"),
GetSQLValueString($HTTP_POST_VARS['passportexpiry'], "date"),
GetSQLValueString($HTTP_POST_VARS['M_passport_issuing_authority'], "text"),
GetSQLValueString($HTTP_POST_VARS['M_visatype'], "text"),
GetSQLValueString($HTTP_POST_VARS['M_visa_number'], "text"),
GetSQLValueString($HTTP_POST_VARS['M_issue_date'], "date"),
GetSQLValueString($HTTP_POST_VARS['M_visaexpiry'], "date"),
GetSQLValueString($HTTP_POST_VARS['M_tm6'], "text"),
GetSQLValueString($HTTP_POST_VARS['M_visacheckpoint'], "text"),
GetSQLValueString($HTTP_POST_VARS['M_emergency_contact_name'], "text"),
GetSQLValueString($HTTP_POST_VARS['M_emergency_contact_number'], "text"),
GetSQLValueString($HTTP_POST_VARS['M_emergency_contact_email'], "text"),
GetSQLValueString($HTTP_POST_VARS['M_dietary_requirements'], "text"),
GetSQLValueString($HTTP_POST_VARS['M_dietary_notes'], "text"),
GetSQLValueString($HTTP_POST_VARS['M_medical_conditions'], "text"),
GetSQLValueString($HTTP_POST_VARS['M_medical_notes'], "text"),
GetSQLValueString($HTTP_POST_VARS['M_timestamp'], "date"),
GetSQLValueString($HTTP_POST_VARS['M_insurance_company'], "text"),
GetSQLValueString($HTTP_POST_VARS['M_insurance_policynumber'], "text"),
GetSQLValueString($HTTP_POST_VARS['M_insurance_expirydate'], "date"),
GetSQLValueString($HTTP_POST_VARS['M_ipaddress'], "text"),
GetSQLValueString($HTTP_POST_VARS['id_member'], "int"));
mysql_select_db($database_mirrorfoundation, $mirrorfoundation);
$Result1 = mysql_query($updateSQL, $mirrorfoundation) or die(mysql_error());
$updateGoTo = "app01formconfirm.php";
if (isset($_SERVER['QUERY_STRING'])) {
$updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
$updateGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $updateGoTo));
}
mysql_select_db($database_mirrorfoundation, $mirrorfoundation);
$query_users = sprintf("SELECT id_member, real_name, passwd, startdate, enddate, DATEDIFF(startdate,CURDATE()) AS daysbeforestart, DATEDIFF(enddate, CURDATE()) AS daysbeforeend, email_address, M_first_name, M_last_name, M_country, M_nationality, M_gender, dob, M_emergency_contact_name, M_emergency_contact_number, M_emergency_contact_email, M_dietary_requirements, M_dietary_notes, M_medical_conditions, M_medical_notes, M_passport_number, passportexpiry, M_passport_issuing_authority, M_visa_number, flightarrival, flight, M_active, M_timestamp, M_volunteer_type, M_agree_terms, M_program, M_insurance_company, M_insurance_policynumber, M_insurance_expirydate, M_visatype, M_visa_number, M_issue_date, M_visaexpiry, M_tm6, M_visacheckpoint, M_ipaddress FROM smf_members WHERE id_member = $userid");
$users = mysql_query($query_users, $mirrorfoundation) or die(mysql_error());
$row_users = mysql_fetch_assoc($users);
$totalRows_users = mysql_num_rows($users);
mysql_select_db($database_mirrorfoundation, $mirrorfoundation);
$query_countries = "SELECT country_id, country FROM countries ORDER BY country ASC";
$countries = mysql_query($query_countries, $mirrorfoundation) or die(mysql_error());
$row_countries = mysql_fetch_assoc($countries);
$totalRows_countries = mysql_num_rows($countries);
mysql_select_db($database_mirrorfoundation, $mirrorfoundation);
$query_nationalities = "SELECT country_id, nationality FROM countries ORDER BY nationality ASC";
$nationalities = mysql_query($query_nationalities, $mirrorfoundation) or die(mysql_error());
$row_nationalities = mysql_fetch_assoc($nationalities);
$totalRows_nationalities = mysql_num_rows($nationalities);
mysql_select_db($database_mirrorfoundation, $mirrorfoundation);
$query_gender = "SELECT id, gender FROM volunteer_gender ORDER BY id ASC";
$gender = mysql_query($query_gender, $mirrorfoundation) or die(mysql_error());
$row_gender = mysql_fetch_assoc($gender);
$totalRows_gender = mysql_num_rows($gender);
mysql_select_db($database_mirrorfoundation, $mirrorfoundation);
$query_hours = "SELECT id FROM volunteer_hours";
$hours = mysql_query($query_hours, $mirrorfoundation) or die(mysql_error());
$row_hours = mysql_fetch_assoc($hours);
$totalRows_hours = mysql_num_rows($hours);
mysql_select_db($database_mirrorfoundation, $mirrorfoundation);
$query_minutes = "SELECT id, `minute` FROM volunteer_minutes ORDER BY id ASC";
$minutes = mysql_query($query_minutes, $mirrorfoundation) or die(mysql_error());
$row_minutes = mysql_fetch_assoc($minutes);
$totalRows_minutes = mysql_num_rows($minutes);
mysql_select_db($database_mirrorfoundation, $mirrorfoundation);
$query_thaicheckpoints = "SELECT id, code, checkpoint_en, sortcode FROM volunteer_thaicheckpoints ORDER BY sortcode, checkpoint_en ASC";
$thaicheckpoints = mysql_query($query_thaicheckpoints, $mirrorfoundation) or die(mysql_error());
$row_thaicheckpoints = mysql_fetch_assoc($thaicheckpoints);
$totalRows_thaicheckpoints = mysql_num_rows($thaicheckpoints);
mysql_select_db($database_mirrorfoundation, $mirrorfoundation);
$query_visatypes = "SELECT id, govt_code, govt_type_eng, visatype, subtype, maxlengthofstay, `description`, active FROM volunteer_visatypes WHERE active = 1 ORDER BY visatype ASC";
$visatypes = mysql_query($query_visatypes, $mirrorfoundation) or die(mysql_error());
$row_visatypes = mysql_fetch_assoc($visatypes);
$totalRows_visatypes = mysql_num_rows($visatypes);
mysql_select_db($database_mirrorfoundation, $mirrorfoundation);
$query_flights = "SELECT id, airline, flightnumber, schedule_startdate, schedule_enddate, dep, arr FROM volunteer_flights ORDER BY airline, schedule_startdate, arr ASC";
$flights = mysql_query($query_flights, $mirrorfoundation) or die(mysql_error());
$row_flights = mysql_fetch_assoc($flights);
$totalRows_flights = mysql_num_rows($flights);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php echo $pagetitle; ?></title>
<link href="../Themes/default/style.css" rel="stylesheet" type="text/css" />
<script language="JavaScript" src="../admin_includes/calendar3.js"></script>
<link href="../admin_includes/appformpages.css" rel="stylesheet" type="text/css" />
</head>
<body>
<table width="100%" align="center" cellpadding="3" cellspacing="2" bgcolor="#FFFFFF" class="appformtable">
<form action="<?php echo $editFormAction; ?>" method="post" name="form1">
<tr>
<td colspan="2" class="appheader">Volunteer Application Form<br />
<?php
echo ssi_welcome(); ?><br />
<?php
echo $userid; ?> and from db: <?php echo $row_users['id_member']; ?>
<br>
</td>
</tr>
<tr valign="baseline">
<td colspan="2" class="appformprogramstartdate"><p>You have applied to join the <?php echo $row_users['M_program']; ?> programme<br />
<?php echo date('l jS F Y', strtotime($row_users['startdate'])); ?> - <?php echo date('l jS F Y', strtotime($row_users['enddate'])); ?>.</p>
<p>If your start date or end date changes, please email us urgently so we can update your details<br />
If your other details change or cannot be filled in now, please login again when you can change them.</p></td>
</tr>
<tr>
<td colspan="2" class="appformintro"><p>Please fill in every field - we use these details to prepare for your arrival:
</p>
<p>Arrival details means we can arrange your pickup, diet details mean we can buy in the correct type of food with less waste. Emergency contact details ensure we can contact next of kin in the event of a problem.</p>
<p>To remind you - <br />
<span style="font-weight:bold">Valid insurance is mandatory</span> - you cannot volunteer without it<br />
By filling in part, or all, of this form, it is deemed that you have waived any claim of liability against The Mirror Foundation, agreed to follow our rules, and read and agreed to our Terms & Conditions. <br />
It is YOUR responsibility to make sure you are aware of all of these before you arrive.</p></td>
</tr>
<tr valign="baseline" class="appformsectionheadecell">
<td colspan="2">Basic information</td>
</tr>
<tr valign="baseline" class="appformboldright">
<td>First Name</td>
<td width="551" class="appformboldleft"><input class="appformboldleft" type="text" name="M_first_name" value="<?php echo $row_users['M_first_name']; ?>" size="32"></td>
</tr>
<tr valign="baseline" class="appformboldright">
<td class="appformbold">Last Name</td>
<td class="appformboldleft">
<input class="appformboldleft" type="text" name="M_last_name" value="<?php echo $row_users['M_last_name']; ?>" size="32">
</td>
</tr>
<tr valign="baseline" class="appformboldright">
<td class="appformbold">Email</td>
<td class="appformboldleft">
<input name="email_address" type="text" class="appformboldleft" value="<?php echo $row_users['email_address']; ?>" size="32">
</font></td>
</tr>
<tr valign="baseline" class="appformboldright">
<td class="appformbold">Country/Nationality (both please)</td>
<td class="appformboldleft">
<select class="appformboldleft" name="M_country">
<option value="Unselected" <?php if (!(strcmp("Unselected", $row_users['M_country']))) {echo "selected=\"selected\"";} ?>>Select</option>
<?php
do {
?>
<option value="<?php echo $row_countries['country']?>"<?php if (!(strcmp($row_countries['country'], $row_users['M_country']))) {echo "selected=\"selected\"";} ?>><?php echo $row_countries['country']?></option>
<?php
} while ($row_countries = mysql_fetch_assoc($countries));
$rows = mysql_num_rows($countries);
if($rows > 0) {
mysql_data_seek($countries, 0);
$row_countries = mysql_fetch_assoc($countries);
}
?>
</select>
<select class="appformboldleft" name="M_nationality">
<option value="Unselected" <?php if (!(strcmp("Unselected", $row_users['M_nationality']))) {echo "selected=\"selected\"";} ?>>Select</option>
<?php
do {
?>
<option value="<?php echo $row_nationalities['nationality']?>"<?php if (!(strcmp($row_nationalities['nationality'], $row_users['M_nationality']))) {echo "selected=\"selected\"";} ?>><?php echo $row_nationalities['nationality']?></option>
<?php
} while ($row_nationalities = mysql_fetch_assoc($nationalities));
$rows = mysql_num_rows($nationalities);
if($rows > 0) {
mysql_data_seek($nationalities, 0);
$row_nationalities = mysql_fetch_assoc($nationalities);
}
?>
</select>
</td>
<tr valign="baseline" class="appformboldright">
<td class="appformbold">Gender</td>
<td class="appformboldleft">
<select class="appformboldleft" name="M_gender">
<option value="Unselected" <?php if (!(strcmp("Unselected", $row_users['M_gender']))) {echo "selected=\"selected\"";} ?>>Sex</option>
<?php
do {
?>
<option value="<?php echo $row_gender['gender']?>"<?php if (!(strcmp($row_gender['gender'], $row_users['M_gender']))) {echo "selected=\"selected\"";} ?>><?php echo $row_gender['gender']?></option>
<?php
} while ($row_gender = mysql_fetch_assoc($gender));
$rows = mysql_num_rows($gender);
if($rows > 0) {
mysql_data_seek($gender, 0);
$row_gender = mysql_fetch_assoc($gender);
}
?>
</select>
</td>
</tr>
<tr valign="baseline" class="appformboldright">
<td class="appformbold">Date of Birth</td>
<td class="appformboldleft"><input onBlur="Pick the date using the calendar please - or enter using the following format: YYYY-MM-DD (once entered, click on the calendar to make sure it brings up the correct date" title="Pick the date using the calendar please - or enter using the following format: YYYY-MM-DD (once entered, click on the calendar to make sure it brings up the correct date" class="appformboldleft" name="dob" type="text" id="dob" value="<?php echo $row_users['dob']; ?>" size="10" />
<a href="javascript:cal1.popup();"> <img src="file:///C|/Users/User/Sites/cal.gif" width="16" height="16" border="0" /></a></td>
</tr>
<tr valign="baseline" class="appformsectionheadecell">
<td colspan="2">Emergency Contact information</td>
</tr>
<tr valign="baseline" class="appformboldright">
<td class="appformbold">Emergency Contact Name</td>
<td class="appformboldleft"><input class="appformboldleft" type="text" name="M_emergency_contact_name" value="<?php echo $row_users['M_emergency_contact_name']; ?>" size="30"></td>
</tr>
<tr valign="baseline" class="appformboldright">
<td class="appformbold">Emergency Contact Number</td>
<td class="appformboldleft"><input class="appformboldleft" type="text" name="M_emergency_contact_number" value="<?php echo $row_users['M_emergency_contact_number']; ?>" size="30"></td>
</tr>
<tr valign="baseline" class="appformboldright">
<td class="appformbold">Emergency Contact Email</td>
<td class="appformboldleft"><input class="appformboldleft" type="text" name="M_emergency_contact_email" value="<?php echo $row_users['M_emergency_contact_email']; ?>" size="30"></td>
</tr>
<tr valign="baseline" class="appformsectionheadecell">
<td colspan="2">Passport information<br />
<span class="appformintro">We require you to bring a photocopy of your main information AND Thai visa pages in your passport</span></td>
</tr>
<tr valign="baseline" class="appformboldright">
<td class="appformbold">Passport Number</td>
<td class="appformboldleft"><input class="appformboldleft" name="M_passport_number" type="text" value="<?php echo $row_users['M_passport_number']; ?>" size="30"></td>
</tr>
<tr valign="baseline" class="appformboldright">
<td class="appformbold">Passport Expiry Date</td>
<td class="appformboldleft"><input class="appformboldleft" name="passportexpiry" type="text" id="passportexpiry" value="<?php echo $row_users['passportexpiry']; ?>" size="10" readonly="" /> <a href="javascript:cal2.popup();"> <img src="file:///C|/Users/User/Sites/cal.gif" width="16" height="16" border="0" /></a> Pick the date using the calendar please</td>
</tr>
<tr valign="baseline" class="appformboldright">
<td class="appformbold">Passport Issuing Authority</td>
<td class="appformboldleft"><input class="appformboldleft" name="M_passport_issuing_authority" type="text" value="<?php echo $row_users['M_passport_issuing_authority']; ?>" size="30"></td>
</tr>
<tr valign="baseline" class="appformsectionheadecell">
<td colspan="2">Visa information</td>
</tr> <tr class="appformboldright">
<td colspan="2"><table width="90%" border="3" align="center" cellpadding="2" cellspacing="1" bgcolor="#FFFFFF">
<tr>
<td colspan="6" class="appformintro">New Thai government rules mean we have had to add additional fields to the form, relating to your visa.<br />
ALL of the visa fields MUST be filled in*<br />
*BUT, there is no visa number
for 'Visas On Arrival'.<br />
The TM6 field can only be filled in after you have entered Thailand - this number is found on the arrival/departure card stapled to your passport at Passport Control.</td>
</tr>
<tr>
<td>Visa Type</td>
<td>Number</td>
<td>Issue Date</td>
<td>Point of Entry</td>
<td>TM6</td>
<td>Exit Date</td>
</tr>
<tr>
<td><span class="appformboldleft">
<select name="M_visatype" class="appformboldleft">
<option value="Unselected" <?php if (!(strcmp("Unselected", $row_users['M_visatype']))) {echo "selected=\"selected\"";} ?>>Unselected</option>
<?php
do {
?>
<option value="<?php echo $row_visatypes['govt_code']?>"<?php if (!(strcmp($row_visatypes['govt_code'], $row_users['M_visatype']))) {echo "selected=\"selected\"";} ?>><?php echo $row_visatypes['visatype']?></option>
<?php
} while ($row_visatypes = mysql_fetch_assoc($visatypes));
$rows = mysql_num_rows($visatypes);
if($rows > 0) {
mysql_data_seek($visatypes, 0);
$row_visatypes = mysql_fetch_assoc($visatypes);
}
?>
</select>
</span></td>
<td><span class="appformboldleft">
<input name="M_visa_number" class="appformboldleft" type="text" value="<?php echo $row_users['M_visa_number']; ?>" size="10" />
</span></td>
<td><input name="M_issue_date" class="appformboldleft" type="date" size="10" value="<?php echo $row_users['M_issue_date']; ?>" /> <a href="javascript:cal6.popup();"> <img src="file:///C|/Users/User/Sites/cal.gif" width="16" height="16" border="0" /></a></td>
<td><span class="appformboldleft">
<select name="M_visacheckpoint" class="appformboldleft">
<option value="Unselected" <?php if (!(strcmp("Unselected", $row_users['M_visacheckpoint']))) {echo "selected=\"selected\"";} ?>>Unselected</option>
<?php
do {
?>
<option value="<?php echo $row_thaicheckpoints['code']?>"<?php if (!(strcmp($row_thaicheckpoints['code'], $row_users['M_visacheckpoint']))) {echo "selected=\"selected\"";} ?>><?php echo $row_thaicheckpoints['checkpoint_en']?></option>
<?php
} while ($row_thaicheckpoints = mysql_fetch_assoc($thaicheckpoints));
$rows = mysql_num_rows($thaicheckpoints);
if($rows > 0) {
mysql_data_seek($thaicheckpoints, 0);
$row_thaicheckpoints = mysql_fetch_assoc($thaicheckpoints);
}
?>
</select>
</span></td>
<td><span class="appformboldleft">
<input name="M_tm6" class="appformboldleft" type="text" value="<?php echo $row_users['M_tm6']; ?>" size="10" />
</span></td>
<td><span class="appformboldleft">
<input name="M_visaexpiry" class="appformboldleft" type="date" size="10" value="<?php echo $row_users['M_visaexpiry']; ?>" />
<a href="javascript:cal5.popup();"> <img src="file:///C|/Users/User/Sites/cal.gif" width="16" height="16" border="0" /></a></span></td>
</tr>
</table></td>
</tr>
<tr valign="baseline" class="appformsectionheadecell">
<td colspan="2">Extra information</td>
</tr>
<tr valign="baseline" class="appformboldright">
<td class="appformbold">Special Diet Type</td>
<td class="appformboldleft"><select name="M_dietary_requirements" class="appformboldleft">
<option value="Unselected" <?php if (!(strcmp("Unselected", $row_users['M_dietary_requirements']))) {echo "selected=\"selected\"";} ?>>Select</option>
<option value="none" <?php if (!(strcmp("none", $row_users['M_dietary_requirements']))) {echo "selected=\"selected\"";} ?>>None</option>
<option value="halal" <?php if (!(strcmp("halal", $row_users['M_dietary_requirements']))) {echo "selected=\"selected\"";} ?>>Halal</option>
<option value="vegetarian" <?php if (!(strcmp("vegetarian", $row_users['M_dietary_requirements']))) {echo "selected=\"selected\"";} ?>>Vegetarian</option>
<option value="allergy" <?php if (!(strcmp("allergy", $row_users['M_dietary_requirements']))) {echo "selected=\"selected\"";} ?>>Allergy</option>
<option value="other" <?php if (!(strcmp("other", $row_users['M_dietary_requirements']))) {echo "selected=\"selected\"";} ?>>Other</option>
</select></td>
</tr>
<tr valign="baseline" class="appformboldright">
<td class="appformbold">Diet Additional Notes</td>
<td class="appformboldleft"><textarea name="M_dietary_notes" cols="50" rows="3" class="appformboldleft"><?php echo $row_users['M_dietary_notes']; ?></textarea></td>
</tr>
<tr valign="baseline" class="appformboldright">
<td class="appformbold">Medical Condition?</td>
<td class="appformboldleft"><select name="M_medical_conditions" class="appformboldleft">
<option value="" <?php if (!(strcmp("", $row_users['M_medical_conditions']))) {echo "selected=\"selected\"";} ?>>Select</option>
<option value="yes" <?php if (!(strcmp("yes", $row_users['M_medical_conditions']))) {echo "selected=\"selected\"";} ?>>Yes</option>
<option value="no" <?php if (!(strcmp("no", $row_users['M_medical_conditions']))) {echo "selected=\"selected\"";} ?>>No</option>
</select></td>
</tr>
<tr valign="baseline" class="appformboldright">
<td class="appformbold">(If Yes, please explain)</td>
<td class="appformboldleft"><textarea name="M_medical_notes" cols="50" rows="3" class="appformboldleft"><?php echo $row_users['M_medical_notes']; ?></textarea></td>
</tr>
<tr>
<td></td>
</tr>
<tr valign="baseline" class="appformsectionheadecell">
<td colspan="2">Insurance information</td>
</tr>
<tr valign="baseline">
<td colspan="2" class="appformintro">Travel insurance is mandatory to volunteer with The Mirror Foundation. We require proof of insurance coverage, otherwise you will not be allowed to join the programme.</td>
</tr>
<tr valign="baseline" class="appformboldright">
<td class="appformbold">Insurance Company</td>
<td class="appformboldleft"><input class="appformboldleft" name="M_insurance_company" type="text" value="<?php echo $row_users['M_insurance_company']; ?>" size="30"></td>
</tr>
<tr valign="baseline" class="appformboldright">
<td class="appformbold">Insurance Policy Number</td>
<td class="appformboldleft"><input class="appformboldleft" name="M_insurance_policynumber" type="text" value="<?php echo $row_users['M_insurance_policynumber']; ?>" size="30">
</td>
</tr>
<tr valign="baseline" class="appformboldright">
<td class="appformbold">Insurance Expiry Date</td>
<td class="appformboldleft"><input class="appformboldleft" name="M_insurance_expirydate" type="date" value="<?php echo $row_users['M_insurance_expirydate']; ?>" size="10" readonly="" />
<a href="javascript:cal4.popup();"> <img src="file:///C|/Users/User/Sites/cal.gif" width="16" height="16" border="0" /></a> Pick the date using the calendar please
</td>
</tr>
<tr valign="baseline" class="appformsectionheadecell">
<td colspan="2">Flight Arrival information (only needed for those landing in Chiang Rai on <?php echo date('jS F Y', strtotime($row_users['startdate'])); ?>)</td>
</tr>
<tr valign="baseline">
<td colspan="2" class="appformintro">Please arrange morning flights if possible
- we cannot guarantee pickups after 5pm<br />
If you are not arriving by air on the programme start date, we pick up from our <a href="http://www.mirrorartgroup.org/guesthouse">guesthouse</a> in town at 9am on that morning</td>
</tr>
<tr valign="baseline" class="appformboldright">
<td class="appformbold">Flight Arrival Date</td>
<td class="appformboldleft"><input class="appformboldleft" name="flightarrival" type="text" id="flightarrival" value="<?php echo $row_users['flightarrival']; ?>" size="10" readonly="" />
<a href="javascript:cal3.popup();"> <img src="file:///C|/Users/User/Sites/cal.gif" width="16" height="16" border="0" /></a>
Flight:
<select name="flight" id="flight" class="appformboldleft" >
<option value="0" <?php if (!(strcmp(0, $row_users['flight']))) {echo "selected=\"selected\"";} ?>>No airport pickup</option>
<?php
do {
?>
<option value="<?php echo $row_flights['id']?>"<?php if (!(strcmp($row_flights['id'], $row_users['flight']))) {echo "selected=\"selected\"";} ?>><?php echo $row_flights['airline']?>: <?php echo $row_flights['flightnumber']?> Dep: <?php echo date('H:i', strtotime($row_flights['dep'])); ?> Arr: <?php echo date('H:i', strtotime($row_flights['arr'])); ?></option>
<?php
} while ($row_flights = mysql_fetch_assoc($flights));
$rows = mysql_num_rows($flights);
if($rows > 0) {
mysql_data_seek($flights, 0);
$row_flights = mysql_fetch_assoc($flights);
}
?>
</select></td>
</tr> <tr valign="baseline">
<td colspan="2" bgcolor="#CCCCCC" class="invoice_pickselectsearchbutton">
<input name="Submit" type="submit" class="invoice_pickselectsearchbutton" value="Update Record" />
<input type="hidden" name="M_timestamp" value="">
<input type="hidden" name="id_member" value="<?php echo $row_users['id_member']; ?>">
<input type="hidden" name="MM_update" value="form1">
</form>
</table>
</body>
</html>
<script language="JavaScript">
var cal1 = new calendar3(document.forms['form1'].elements['dob']);
cal1.year_scroll = true;
cal1.time_comp = false;
var cal2 = new calendar3(document.forms['form1'].elements['passportexpiry']);
cal2.year_scroll = true;
cal2.time_comp = false;
var cal3 = new calendar3(document.forms['form1'].elements['flightarrival']);
cal3.year_scroll = true;
cal3.time_comp = false;
var cal4 = new calendar3(document.forms['form1'].elements['M_insurance_expirydate']) ;
cal4.year_scroll = true;
cal4.time_comp = false;
var cal5 = new calendar3(document.forms['form1'].elements['M_visaexpiry']);
cal5.year_scroll = true;
cal5.time_comp = false;
var cal6 = new calendar3(document.forms['form1'].elements['M_issue_date']);
cal6.year_scroll = true;
cal6.time_comp = false;
</script>
<?php
template_body_below();
template_html_below();
?>
<?php
mysql_free_result($users);
mysql_free_result($countries);
mysql_free_result($nationalities);
mysql_free_result($gender);
mysql_free_result($hours);
mysql_free_result($minutes);
mysql_free_result($thaicheckpoints);
mysql_free_result($visatypes);
mysql_free_result($flights);
?>
Copy link to clipboard
Copied
ok, i've stripped everything out and started from scratch. adding sections in one by one, testing as i go.
i also removed some of the automatically produced dreamweaver code. it nows works fine, but it will take quite a while to redo the form, and all the others i have to do as well.
still it means i can crack on with my work again, until the next brickwall i hit.
just like to thank everyone for all their help, without which i may have never decided to start from scratch.
it's been emotional.
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more