I having a bit of a issue with php, i have created this submission form, however some of the parts should have what if statements and i am not sure how to implement them into my jquery.
here is the actual page.http://www.greatsoutherngroup.ca/contactform.php
here is my php code. everything highlighted in that colour should be a part of the if or else statement. however only the first declaration worked so far(thats the name of the first if or else statement name) below you will find my jquery code attached
1. How do i continue writing the function in jquery so that when i press yes on first question, one slides out and once i answered that question the other slides out. So on and so forth (one by one)
2. what do i do when it comes to filling out the form the radio buttons don't appear when i receive the email with text only the first part of the form. Please help
if (isset($_REQUEST[\"superkillcache\"])) { session_unset(); }
function getRealIp() { if (!empty($_SERVER['HTTP_CLIENT_IP'])) { //check ip from share internet $ip=$_SERVER['HTTP_CLIENT_IP']; } elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) { //to check ip is pass from proxy $ip=$_SERVER['HTTP_X_FORWARDED_FOR']; } else { $ip=$_SERVER['REMOTE_ADDR']; } return $ip; }
function writeLog($where) {
$ip = getRealIp(); // Get the IP from superglobal $host = gethostbyaddr($ip); // Try to locate the host of the attack $date = date(\"d M Y\");
// create a logging message with php heredoc syntax $logging = <<<LOG \n << Start of Message >> There was a hacking attempt on your form. \n Date of Attack: {$date} IP-Adress: {$ip} \n Host of Attacker: {$host} Point of Attack: {$where} << End of Message >> LOG; // Awkward but LOG must be flush left
// open log file if($handle = fopen('hacklog.log', 'a')) {
fputs($handle, $logging); // write the Data to file fclose($handle); // close the file
} else { // if first method is not working, for example because of wrong file permissions, email the data
// check if a session is started and a token is transmitted, if not return an error if(!isset($_SESSION[$form.'_token'])) { return false; }
// check if the form is sent with token in it if(!isset($_POST['token'])) { return false; }
// compare the tokens against each other if they are still the same if ($_SESSION[$form.'_token'] !== $_POST['token']) { return false; }
return true; }
function generateFormToken($form) {
// generate a token from an unique value, took from microtime, you can also use salt-values, other crypting methods... $token = md5(uniqid(microtime(), true));
// Write the generated token to the session variable to check it against the hidden field when the form is sent $_SESSION[$form.'_token'] = $token;
return $token; }
// INIT $form = 'form1'; $checkWhiteList = false;
// CHECK IF FORM HAS BEEN SUBMITTED if (isset($_POST['token'])) {
// FORM SUBMITTED, VERIFY LEGITIMACY OF TOKEN if (verifyFormToken($form)) {
// Building a whitelist array with keys which will send through the form, no others would be accepted later on if ($checkWhiteList) { $whitelist = array('token','req-name','req-birth','req-address','req-address-2','req-phonenumber','req-emailad','req-dest','req-size','adults','Child','infant','req-pref','req-date','req-dep','req-return','addURLS','mult','newText','save-stuff','declaration','declaration4','declaration5','declaration6','declaration7','declaration8','declaration9','declaration10','declaration11','declaration12','declaration13','declaration14','declaration15','declaration16','declaration17','declaration18','declaration19','declaration20','declaration21','declaration22','declaration23','declaration24','declaration25','declaration26','declaration27');
// Building an array with the $_POST-superglobal foreach ($_POST as $key=>$item) {
// Check if the value $key (fieldname from $_POST) can be found in the whitelisting array, if not, die with a short message to the hacker if (!in_array($key, $whitelist)) {
writeLog('Unknown form fields'); die(\"Hack-Attempt detected. Please use only the fields in the form\");
} } }
// Lets check the URL whether it's a real URL or not. if not, stop the script /* if(!filter_var($_POST['URL-main'],FILTER_VALIDATE_URL)) { writeLog('URL Validation'); die('Hack-Attempt detected. Please insert a valid URL'); } */
// SAVE INFO AS COOKIE, if user wants name and email saved
<h3> </h3> <h3>Declaration – You declare that the information you will provide in this questionnaire is truthful, complete and accurate. If you misrepresent your medical status in this questionnaire or don’t disclose material information about your medical status,your coverage will be null and void.</h3> [b]<div class=\"rowElem\"> <label for=\"declaration\"> I declare that I will answer the questionnaire truthfully, completely and accurately.</label> <!-- <input type=\"checkbox\" name=\"mult\" id=\"multCheck\" /> --> <input type=\"radio\" name=\"declaration\" id=\"declaration_yes\" value=\"yes\" /> Yes<br /> <input type=\"radio\" name=\"declaration\" id=\"declaration_no\" value=\"no\" checked=\"checked\" /> No
</div>
<div id=\"addURLSArea\"> <div class=\"rowElem\"> <label for=\"addURLs\">Are you under 61 years of age and travelling for less than 35 days?</label> <!-- <input type=\"checkbox\" name=\"mult\" id=\"multCheck\" /> --> <input type=\"radio\" name=\"declaration3\" id=\"declaration3_yes\" value=\"yes\" /> Yes<br /> <input type=\"radio\" name=\"declaration3\" id=\"declaration3_no\" value=\"no\" checked=\"checked\" /> No
</div>
<div class=\"rowElem\"> <label for=\"addURLs\">Are you well and have no reason to expect medical treatment while travelling?</label> <!--<textarea cols=\"40\" rows=\"4\" name=\"addURLS\"></textarea> />--> <input type=\"radio\" name=\"declaration4\" id=\"declaration4_yes\" value=\"yes\" /> Yes<br /> <input type=\"radio\" name=\"declaration4\" id=\"declaration4_no\" value=\"no\" checked=\"checked\" /> No </div>
<div class=\"rowElem\"> <label for=\"addURLs\">Has your physician advised or recommended that you not travel on the trip applicable to this application?</label> <!-- <input type=\"checkbox\" name=\"mult\" id=\"multCheck\" /> --> <input type=\"radio\" name=\"declaration5\" id=\"declaration5_yes\" value=\"yes\" /> Yes<br /> <input type=\"radio\" name=\"declaration5\" id=\"declaration5_no\" value=\"no\" checked=\"checked\" /> No
</div>
<h3> </h3> <h3>Do you suffer from or have you been diagnosed with:</h3> <div class=\"rowElem\"> <label for=\"addURLs\">a) has been diagnosed with a terminal illness</label> <!-- <input type=\"checkbox\" name=\"mult\" id=\"multCheck\" /> --> <input type=\"radio\" name=\"declaration6\" id=\"declaration6_yes\" value=\"yes\" /> Yes<br /> <input type=\"radio\" name=\"declaration6\" id=\"declaration6_no\" value=\"no\" checked=\"checked\" /> No
</div>
<div class=\"rowElem\"> <label for=\"addURLs\">b) has Acquired Immune Deficiency Syndrome (AIDS) or Human Immunodeficiency Virus (HIV)</label> <!-- <input type=\"checkbox\" name=\"mult\" id=\"multCheck\" /> --> <input type=\"radio\" name=\"declaration7\" id=\"declaration7_yes\" value=\"yes\" /> Yes<br /> <input type=\"radio\" name=\"declaration7\" id=\"declaration7_no\" value=\"no\" checked=\"checked\" /> No
<div class=\"rowElem\"> <label for=\"addURLs\">c) has Alzheimer’s Disease or any other type of dementia </label> <!-- <input type=\"checkbox\" name=\"mult\" id=\"multCheck\" /> --> <input type=\"radio\" name=\"declaration8\" id=\"declaration8_yes\" value=\"yes\" /> Yes<br /> <input type=\"radio\" name=\"declaration8\" id=\"declaration8_no\" value=\"no\" checked=\"checked\" /> No
</div>
<div class=\"rowElem\"> <label for=\"addURLs\">d) has received any type of treatment for pancreatic cancer,liver cancer,or any type of cancer that has metastasized </label> <!-- <input type=\"checkbox\" name=\"mult\" id=\"multCheck\" /> --> <input type=\"radio\" name=\"declaration9\" id=\"declaration9_yes\" value=\"yes\" /> Yes<br /> <input type=\"radio\" name=\"declaration9\" id=\"declaration9_no\" value=\"no\" checked=\"checked\" /> No
</div>
<div class=\"rowElem\"> <label for=\"addURLs\">e) has been prescribed home oxygen therapy treatment in the last 12 months </label> <!-- <input type=\"checkbox\" name=\"mult\" id=\"multCheck\" /> --> <input type=\"radio\" name=\"declaration10\" id=\"declaration10_yes\" value=\"yes\" /> Yes<br /> <input type=\"radio\" name=\"declaration10\" id=\"declaration10_no\" value=\"no\" checked=\"checked\" /> No
</div>
<div class=\"rowElem\"> <label for=\"addURLs\">f) has had a major organ transplant (heart, kidney, liver,lung) </label> <!-- <input type=\"checkbox\" name=\"mult\" id=\"multCheck\" /> --> <input type=\"radio\" name=\"declaration11\" id=\"declaration11_yes\" value=\"yes\" /> Yes<br /> <input type=\"radio\" name=\"declaration11\" id=\"declaration11_no\" value=\"no\" checked=\"checked\" /> No
</div>
<div class=\"rowElem\"> <label for=\"addURLs\"> g) has received kidney dialysis treatment in the last 12 months </label> <!-- <input type=\"checkbox\" name=\"mult\" id=\"multCheck\" /> --> <input type=\"radio\" name=\"declaration12\" id=\"declaration12_yes\" value=\"yes\" /> Yes<br /> <input type=\"radio\" name=\"declaration12\" id=\"declaration12_no\" value=\"no\" checked=\"checked\" /> No
</div>
<h3> </h3> <h3> In answer to the following questions, do not include: </h3> <p> • Bacterial infections they have fully recovered from </p> <p>• Viral infections (unless currently controlled with prescription medication) </p> <p>• Aspirin, thyroid medication or hormone replacement therapy (HRT) </p> <p>• Normal medical checkups </p>
<p> </p><h3>Have you ever had, been diagnosed with or needed a medical consultation, investigation or prescription medication for any of the following:</h3> </label> <!-- <input type=\"checkbox\" name=\"mult\" id=\"multCheck\" /> --> <input type=\"radio\" name=\"declaration13\" id=\"declaration13_yes\" value=\"yes\" /> Yes<br /> <input type=\"radio\" name=\"declaration13\" id=\"declaration13_no\" value=\"no\" checked=\"checked\" /> No
<p> </p> <p>• coronary artery by-pass</p> <p>• valve replacement </p> <p>• an aneurysm that hasn’t been repaired yet </p> <p>• transient ischemic attack (TIA), a stroke or a cerebrovascular condition </p> <p>• a blood disorder</p>
</div>
<div class=\"rowElem\"> <label for=\"addURLs\"> <p> </p> <h3>Are you taking five or more prescription medications? </h3></label> <!-- <input type=\"checkbox\" name=\"mult\" id=\"multCheck\" /> --> <input type=\"radio\" name=\"declaration14\" id=\"declaration14_yes\" value=\"yes\" /> Yes<br /> <input type=\"radio\" name=\"declaration14\" id=\"declaration14_no\" value=\"no\" checked=\"checked\" /> No
<div class=\"rowElem\"> <label for=\"addURLs\"> Has a physician recommended tests, investigations or surgery you haven’t had yet?</label> <!-- <input type=\"checkbox\" name=\"mult\" id=\"multCheck\" /> --> <input type=\"radio\" name=\"declaration15\" id=\"declaration15_yes\" value=\"yes\" /> Yes<br /> <input type=\"radio\" name=\"declaration15\" id=\"declaration15_no\" value=\"no\" checked=\"checked\" /> No
</div>
<h3> </h3> <h3>In the last 5 years, have you had, been diagnosed with, or needed a medical consultation, investigation, or prescription medication for:</h3>
<div class=\"rowElem\"> <label for=\"addURLs\"> Chest pain or angina, congestive heart failure or a heart attack? </label> <!-- <input type=\"checkbox\" name=\"mult\" id=\"multCheck\" /> --> <input type=\"radio\" name=\"declaration16\" id=\"declaration16_yes\" value=\"yes\" /> Yes<br /> <input type=\"radio\" name=\"declaration16\" id=\"declaration16_no\" value=\"no\" checked=\"checked\" /> No
<div class=\"rowElem\"> <label for=\"addURLs\">Do you have osteoporosis or osteopenia?</label> <!-- <input type=\"checkbox\" name=\"mult\" id=\"multCheck\" /> --> <input type=\"radio\" name=\"declaration26\" id=\"declaration26_yes\" value=\"yes\" /> Yes<br /> <input type=\"radio\" name=\"declaration26\" id=\"declaration26_no\" value=\"no\" checked=\"checked\" /> No
</div>
<div class=\"rowElem\"> <label for=\"addURLs\">Do you suffer from Parkinson’s disease, seizures or epilepsy?</label> <!-- <input type=\"checkbox\" name=\"mult\" id=\"multCheck\" /> --> <input type=\"radio\" name=\"declaration27\" id=\"declaration27_yes\" value=\"yes\" /> Yes<br /> <input type=\"radio\" name=\"declaration27\" id=\"declaration27_no\" value=\"no\" checked=\"checked\" /> No
</div>
</div>[/b]
<h3>Please contact us directly enquiries@greatsoutherngroup.ca\"or 1-877-485-2850 to discuss your Travel Insurance needs. We will respond within one business day. </h3>
I having a bit of a issue with php, i have created this submission form, however some of the parts should have what if statements and i am not sure how to implement them into my jquery.
here is the actual page.http://www.greatsoutherngroup.ca/contactform.php
here is my php code. everything highlighted in that colour should be a part of the if or else statement. however only the first declaration worked so far(thats the name of the first if or else statement name)
below you will find my jquery code attached
1. How do i continue writing the function in jquery so that when i press yes on first question, one slides out and once i answered that question the other slides out. So on and so forth (one by one)
2. what do i do when it comes to filling out the form the radio buttons don't appear when i receive the email with text only the first part of the form. Please help
jqeury
$(function(){
$('#change-form')
.jqTransform()
.validate({
submitHandler: function(form) {
$(form).ajaxSubmit({
success: function() {
$('#change-form').hide();
$('#page-wrap2').append(\"<p class='thanks'>Thanks! Your request has been sent.</p>\");
if ( $(\"input[@name='declaration']:checked\").val() == 'yes') {
//If yes is checked
}
else {
//if No is checked
}
}
});
}
});
$(\"#addURLSArea\").hide();
$('.jqTransformRadio').click(function(){
//if ($('#multCheck:checked').val() == 'on') {
if ( $(\"input[@name='declaration']:checked\").val() == 'yes' )
{
$(\"#addURLSArea\").slideDown();
} else {
$(\"#addURLSArea\").slideUp();
}
});
$(\".jqTransformRadio\").click(function() {
if ($(\".jqTransformRadio\").eq(1).attr(\"class\") == \"jqTransformRadio jqTransformChecked\") {
$(\"#curTextArea\").slideUp();
} else {
$(\"#curTextArea\").slideDown();
}
});
});