Re: show of hide a record using php
Posted: Thu May 10, 2012 8:57 am
by jonnyfortis
having a think about it. once the property has been taken it still needs to be used by the applicant as this will be associated with the ID.
i have a dropdown list on the application form that shows the properties. I think i only need to hide it in this list
below is the dynamic select list
<select name="Select Property" id="Select Property" onchange="loadFields(this.value)">
<option value="select your property">select your property</option>
<?php
do {
?>
<option value="<?php echo $row_rsApplyNow['prop_id'] . '|' . $row_rsApplyNow['prop_add1'] . '|' . $row_rsApplyNow['rental_price'] . '|' . $row_rsApplyNow['town'] . '|' . $row_rsApplyNow['county'] . '|' . $row_rsApplyNow['postcode'];?>"><?php echo $row_rsApplyNow['prop_id'] . " , " . $row_rsApplyNow['prop_add1']; ?></option>
<?php
} while ($row_rsApplyNow = mysql_fetch_assoc($rsApplyNow));
$rows = mysql_num_rows($rsApplyNow);
if($rows > 0) {
mysql_data_seek($rsApplyNow, 0);
$row_rsApplyNow = mysql_fetch_assoc($rsApplyNow);
}
?>
</select>
and below is the sql
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form2")) {
$insertSQL = sprintf("INSERT INTO plus_signup (terms, prop_id, StartDate, weeks, EndDate, Title, userid, password, sex, DOBDate, DOBMonth, DOBYear, Nationality, `Marital Status`, PhoneDay, PhoneEvening, PhoneMobile, email, Smoker, NextKin, CurrentAddress, PrevAddress, LivingStatus, Student, BankFinCCJ, BankFinArrears, BankFinBankR, BankFinNone, BankName, BankAccNum, BankSortCode, BankDuration, BankDCard, BankElectoral, LLName, LLTele, LLEmail, LLHost, LLAddress, GuName, GuTitle, GuDobDate, GuDobMonth, GuDobYear, GuSex, GuMarital, GuPhoneDay, GuPhoneEven, GuPhoneMob, GuPhoneEmail, GuCurrentAdd, GuPrevAdd, GuBankName, GuBankAccNu, GuBankSort, GuBankDurat, GuBankDebit, GuBankElect, GuEmpProffes, GuEmpAnnWa, GuEmpPayroll, GuSelfEmp, GuHaveAcc, GuAccName, GuAccContName, GuAccAdd, GuAccDayTel, GuAccMobTel, GuAccEmail, GuAccAdditional, GuEmployerNam, GuEmployerAdd, GuEmployerContactName, GuEmployerTele, GuEmployerEmail, GuEmployerCCj, GuEmployerArr, GuEmployerBankR, GuEmployerNone) 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, %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, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString(isset($_POST['terms']) ? "true" : "", "defined","'Y'","'N'"),
GetSQLValueString($_POST['prop_id'], "text"),
GetSQLValueString($_POST['StartDate'], "text"),
GetSQLValueString($_POST['weeks'], "text"),
GetSQLValueString($_POST['EndDate'], "text"),
GetSQLValueString($_POST['Title'], "text"),
GetSQLValueString($_POST['userid'], "text"),
GetSQLValueString($_POST['password'], "text"),
GetSQLValueString($_POST['sex'], "text"),
GetSQLValueString($_POST['DOBDate'], "text"),
GetSQLValueString($_POST['DOBMonth'], "text"),
GetSQLValueString($_POST['DOBYear'], "text"),
GetSQLValueString($_POST['Nationality'], "text"),
GetSQLValueString($_POST['Marital_Status'], "text"),
GetSQLValueString($_POST['PhoneDay'], "text"),
GetSQLValueString($_POST['PhoneEvening'], "text"),
GetSQLValueString($_POST['PhoneMobile'], "text"),
GetSQLValueString($_POST['email'], "text"),
GetSQLValueString($_POST['Smoker'], "text"),
GetSQLValueString($_POST['NextKin'], "text"),
GetSQLValueString($_POST['CurrentAddress'], "text"),
GetSQLValueString($_POST['PrevAddress'], "text"),
GetSQLValueString($_POST['LivingStatus'], "text"),
GetSQLValueString($_POST['Student'], "text"),
GetSQLValueString(isset($_POST['BankFinCCJ']) ? "true" : "", "defined","'Y'","'N'"),
GetSQLValueString(isset($_POST['BankFinArrears']) ? "true" : "", "defined","'Y'","'N'"),
GetSQLValueString(isset($_POST['BankFinBankR']) ? "true" : "", "defined","'Y'","'N'"),
GetSQLValueString(isset($_POST['BankFinNone']) ? "true" : "", "defined","'Y'","'N'"),
GetSQLValueString($_POST['BankName'], "text"),
GetSQLValueString($_POST['BankAccNum'], "text"),
GetSQLValueString($_POST['BankSortCode'], "text"),
GetSQLValueString($_POST['BankDuration'], "text"),
GetSQLValueString($_POST['BankDCard'], "text"),
GetSQLValueString($_POST['BankElectoral'], "text"),
GetSQLValueString($_POST['LLName'], "text"),
GetSQLValueString($_POST['LLTele'], "text"),
GetSQLValueString($_POST['LLEmail'], "text"),
GetSQLValueString($_POST['LLHost'], "text"),
GetSQLValueString($_POST['LLAddress'], "text"),
GetSQLValueString($_POST['GuName'], "text"),
GetSQLValueString($_POST['GuTitle'], "text"),
GetSQLValueString($_POST['GuDobDate'], "text"),
GetSQLValueString($_POST['GuDobMonth'], "text"),
GetSQLValueString($_POST['GuDobYear'], "text"),
GetSQLValueString($_POST['GuSex'], "text"),
GetSQLValueString($_POST['GuMarital'], "text"),
GetSQLValueString($_POST['GuPhoneDay'], "text"),
GetSQLValueString($_POST['GuPhoneEven'], "text"),
GetSQLValueString($_POST['GuPhoneMob'], "text"),
GetSQLValueString($_POST['GuPhoneEmail'], "text"),
GetSQLValueString($_POST['GuCurrentAdd'], "text"),
GetSQLValueString($_POST['GuPrevAdd'], "text"),
GetSQLValueString($_POST['GuBankName'], "text"),
GetSQLValueString($_POST['GuBankAccNu'], "text"),
GetSQLValueString($_POST['GuBankSort'], "text"),
GetSQLValueString($_POST['GuBankDurat'], "text"),
GetSQLValueString($_POST['GuBankDebit'], "text"),
GetSQLValueString($_POST['GuBankElect'], "text"),
GetSQLValueString($_POST['GuEmpProffes'], "text"),
GetSQLValueString($_POST['GuEmpAnnWa'], "text"),
GetSQLValueString($_POST['GuEmpPayroll'], "text"),
GetSQLValueString($_POST['GuSelfEmp'], "text"),
GetSQLValueString($_POST['GuHaveAcc'], "text"),
GetSQLValueString($_POST['GuAccName'], "text"),
GetSQLValueString($_POST['GuAccContName'], "text"),
GetSQLValueString($_POST['GuAccAdd'], "text"),
GetSQLValueString($_POST['GuAccDayTel'], "text"),
GetSQLValueString($_POST['GuAccMobTel'], "text"),
GetSQLValueString($_POST['GuAccEmail'], "text"),
GetSQLValueString($_POST['GuAccAdditional'], "text"),
GetSQLValueString($_POST['GuEmployerNam'], "text"),
GetSQLValueString($_POST['GuEmployerAdd'], "text"),
GetSQLValueString($_POST['GuEmployerContactName'], "text"),
GetSQLValueString($_POST['GuEmployerTele'], "text"),
GetSQLValueString($_POST['GuEmployerEmail'], "text"),
GetSQLValueString(isset($_POST['GuEmployerCCj']) ? "true" : "", "defined","'Y'","'N'"),
GetSQLValueString(isset($_POST['GuEmployerArr']) ? "true" : "", "defined","'Y'","'N'"),
GetSQLValueString(isset($_POST['GuEmployerBankR']) ? "true" : "", "defined","'Y'","'N'"),
GetSQLValueString(isset($_POST['GuEmployerNone']) ? "true" : "", "defined","'Y'","'N'"));
mysql_select_db($database_hostprop, $hostprop);
$Result1 = mysql_query($insertSQL, $hostprop) or die(mysql_error());
so are you saying i need to add another colomn to the property DB and call it availibilty, mark it has 0 when it has been selected.?
where would the sql query go that you provided?
thanks
would it be easier to do this automatically so as soon as the form is submitted it changes the column to 1?
thanks