phatty34 Posted June 14, 2010 Share Posted June 14, 2010 Whats up could ANYONE please answer one quick programming error question please please?? Below is my php form code but once I upload live and submit form I get this Parse error: parse error, unexpected '=' in /home/content/p/h/a/phatty34/html/contactform1st.php on line 50 Any ideas? Also I think my redirect to thankyou.html is also messed up I hope you can find time to help. THANK YOU. <?php $emailSubject = 'First Time Home Buyer'; $webMaster = '[email protected]'; /* Data Variables */ $FirstName = $_POST['FirstName']; $LastName = $_POST['Lastname']; $Addr1 = $_POST['Addr1']; $email = $_POST['email']; $State = $_POST['State']; $PostalCode =$_POST['PostalCode']; $BusPhone = $_POST['BusPhone']; $HomePhone = $_POST['HomrPhone']; $CellPhone = $_POST['CellPhone']; $Price_Min = $_POST['Price_Min']; $Price_Max = $_POST['Price_Max']; $Location = $_POST['Location']; $age = $_POST['<All_5Years_5-10Years_10-20Years_20YearsPlus']; $HomeType = $_POST['<2 Story_3 Story_1.5 Story_2.5 Story_Bungalow_Raised Bungalow_Frontsplit_Sidesplit_Backsplit']; $Bedrooms = $_POST['<1_2_3_4_5_more']; $Pool = $_POST['<DontCare_Yes_or_No']; $LotSize = $_POST['<.25 acres<.5 acres_.5 acres_1 acres']; $Garage = $_POST['<DontCare_Single_or_Double_or_More']; $FinishedBasement = $_POST['<Full_None_Partial Basement_Finished_Part Finished_With Apartment']; $body = " <br><hr><br> Firstname: $FirstName <br> LastName: $LastName <br> Addr1: $Addr1 <br> email: $email <br> City: $City <br> State: $State <br> age: $age <br> PostalCode: $PostalCode <br> BusPhone: $BusPhone <br> HomePhone: $HomePhone <br> CellPhone: $CellPhone <br> Price_Min: $Price_Min <br> Price_Max: $Price_Max <br> Location: $Location <br> HomeType: $HomeType <br> Bedrooms: $Bedrooms<br> Pool: $Pool <br> LotSize: $LotSize <br> Garage: $Garage <br> FinishedBasement: $FinishedBasement <br>"; if (checkForm.arguments.length < 1) args = checkFormExtra.arguments; else args = checkForm.arguments; var f = args[0]; var form1; if ((typeof (f) == 'string')) { form1 = document.forms[f]; } else { if (!f.form) { return false; } form1 = f.form; } var msg = ""; var arr, field, title, type, minLength, elem, val, cnt, i, j, fieldRq; var valid_url = /^(https?|ftp)://([a-zA-Z0-9._-]+:[a-zA-Z0-9._-]+@)?[a-zA-Z0-9äöüÄÖÜ#._\/~% -]+(\?([a-zA-Z0-9_-]+(=[a-zA-Z0-99äöüÄÖÜß+%?_-]+&?)?)*)?$/; var valid_mail = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9äöüÄÖÜ.-]+.[a-zA-Z]{2,4}$/; var valid_phone = /^[2-9]d{9}$/; // var valid_phone = /^[0-9]\d{1}\[0-9]\d{9}$/; // var valid_phone2 = /^[2-9]\d{2}\-\d{3}\-\d{4}$/; // var valid_phone2 = /^[2-9]\d{2}-\d{3}-\d{4}$/; if (form1) { for (i = 1; i < args.length; i++) { arr = args.split(":"); field = _trim(arr[0]); title = _trim(arr[1]); if (!title) title = field; type = _trim(arr[2]); minLength = _trim(arr[3]); fieldRq = _trim(arr[4]); if (type == 'datetypedropdown') { var check_date_result = check_date_dp(field, title); if (fieldRq > 0 && check_date_result[0] > 0) { msg += check_date_result[1]; } else { } } if (form1.elements && form1.elements[field]) { elem = form1.elements[field]; val = _trim(elem.value); if (val != "") { if (type == "number") { val = val.replace(",", "."); if (isNaN(val)) msg += '"' + title + '" ' + msgNumber + "\n"; } else if (type == "mail" && val.search(valid_mail) == -1) msg += '"' + title + '" ' + msgEMail + "\n"; else if (type == "url" && val.search(valid_url) == -1) msg += '"' + title + '" ' + msgURL + "\n"; else if (type == "datetype") { if (isDate(val, title) == false) { return false; } } else if (type == "phone") { var stripped = val.replace(/[().- ]/g, ''); if (stripped.search(valid_phone) == -1) { msg += msgWrongPhone + "\n\n"; } } } if (minLength && type != 'datetypedropdown') { if (elem.length) { if (elem.options) { for (j = cnt = 0; j < elem.options.length; j++) { if (elem.options[j].selected && elem.options[j].value != "") cnt++; } } else for (j = cnt = 0; j < elem.length; j++) { if (elem[j].checked) cnt++; } } else if (elem.type == "checkbox") cnt = elem.checked ? 1 : 0; else cnt = val.length; // if(cnt < minLength) msg += msgFillOut + ' "' + title + // '"\n'; if (fieldRq == "1" && !cnt) { msg += msgFillOut + ' "' + title + '"\n'; } } } else { msg += msgNoField + ': "' + field + '"\n'; } } if (msg) { alert(msg); return false; } else { echo '<META HTTP-EQUIV="Refresh" Content="0; URL=http://springfieldmenusonline.com/thank_you.html">'; exit; } form1.action = '/formSubmit/confirmed/'; } form1.submit(); if (document.ReDirectTo) { document.ReDirectTo.action = document.ReDirectTo.URLREDIRECT.value; document.ReDirectTo.submit(); } } } else { alert(msgNoForm + ': "' + f + '"'); return false; } } function check_date_dp(fd_name, title) { var msg = ""; var error_counter = 0; var date_field_month = document.getElementsByName(fd_name + "_month")[0].value; var date_field_day = document.getElementsByName(fd_name + "_day")[0].value; var date_field_year = document.getElementsByName(fd_name + "_year")[0].value; if (date_field_month == "") { msg += msgFillOut + ' "Month of ' + title + '"\n'; error_counter++; } if (date_field_day == "") { msg += msgFillOut + ' "Day of ' + title + '"\n'; error_counter++; } if (date_field_year == "") { msg += msgFillOut + ' "Year of ' + title + '"\n'; error_counter++; } var return_r = new Array(error_counter, msg); // if there is no empty field (to generate complete date string otherwise // complete date string becomes null) var insertDate = ""; if (error_counter < 1) { insertDate = number_padding(date_field_month.toString()) + "/"; insertDate += number_padding(date_field_day.toString()) + "/"; insertDate += date_field_year.toString(); } document.getElementsByName(fd_name)[0].value = insertDate; return return_r; } function number_padding(date_num) { if (date_num < 10) { date_num = '0' + date_num.toString(); } return date_num; } var dtCh = "/"; var minYear = 1900; var maxYear = 2100; function isInteger(s) { var i; for (i = 0; i < s.length; i++) { // Check that current character is number. var c = s.charAt(i); if (((c < "0") || (c > "9"))) return false; } // All characters are numbers. return true; } function stripCharsInBag(s, bag) { var i; var returnString = ""; // Search through string's characters one by one. // If character is not in bag, append to returnString. for (i = 0; i < s.length; i++) { var c = s.charAt(i); if (bag.indexOf© == -1) returnString += c; } return returnString; } function daysInFebruary(year) { // February has 29 days in any year evenly divisible by four, // EXCEPT for centurial years which are not also divisible by 400. return (((year % 4 == 0) && ((!(year % 100 == 0)) || (year % 400 == 0))) ? 29 : 28); } function DaysArray(n) { for ( var i = 1; i <= n; i++) { this = 31; if (i == 4 || i == 6 || i == 9 || i == 11) { this = 30; } if (i == 2) { this = 29; } } return this; } function isDate(dtStr, title) { var daysInMonth = DaysArray(12); var pos1 = dtStr.indexOf(dtCh); var pos2 = dtStr.indexOf(dtCh, pos1 + 1); var strMonth = dtStr.substring(0, pos1); var strDay = dtStr.substring(pos1 + 1, pos2); var strYear = dtStr.substring(pos2 + 1); strYr = strYear; if (strDay.charAt(0) == "0" && strDay.length > 1) strDay = strDay.substring(1); if (strMonth.charAt(0) == "0" && strMonth.length > 1) strMonth = strMonth.substring(1); for ( var i = 1; i <= 3; i++) { if (strYr.charAt(0) == "0" && strYr.length > 1) strYr = strYr.substring(1); } month = parseInt(strMonth); day = parseInt(strDay); year = parseInt(strYr); if (pos1 == -1 || pos2 == -1) { alert(title + " : The date format should be : mm/dd/yyyy"); return false; } if (strMonth.length < 1 || month < 1 || month > 12) { alert(title + "Please enter a valid month"); return false; } if (strDay.length < 1 || day < 1 || day > 31 || (month == 2 && day > daysInFebruary(year)) || day > daysInMonth[month]) { alert(title + "Please enter a valid day"); return false; } if (strYear.length != 4 || year == 0 || year < minYear || year > maxYear) { alert(title + "Please enter a valid 4 digit year between " + minYear + " and " + maxYear); return false; } if (dtStr.indexOf(dtCh, pos2 + 1) != -1 || isInteger(stripCharsInBag(dtStr, dtCh)) == false) { alert(title + "Please enter a valid date"); return false; } return true; } // added MIME and charset info $headers = "From: $email\r\nMIME-Version: 1.0\r\nContent-type: text/html; charset=iso-8859-1"; $success = mail($webMaster, $emailSubject, $body, $headers); ?> Link to comment https://forums.phpfreaks.com/topic/204698-helpparse-error-parse-error-unexpected/ Share on other sites More sharing options...
JasonLewis Posted June 14, 2010 Share Posted June 14, 2010 Um, what's with the JavaScript in your PHP code? Did you even follow the line number to the error. You've got PHP code then a whole bunch of JavaScript... Link to comment https://forums.phpfreaks.com/topic/204698-helpparse-error-parse-error-unexpected/#findComment-1071679 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.