dpenguin71 Posted June 23, 2015 Share Posted June 23, 2015 Lines 84-88: if (empty($_POST['HomeInfo'])) { $infoErr = "Information about your home is required. "; } else { $HomeInfo = test_input($_POST['HomeInfo']); } Lines 120-125: function test_input($data) { $data = trim($data); $data = stripslashes($data); $data = htmlspecialchars($data); return $data; } So, why is it saying it is undefined, when it clearly is defined? And, more importantly,how do I fix it? Quote Link to comment Share on other sites More sharing options...
Solution mac_gyver Posted June 23, 2015 Solution Share Posted June 23, 2015 Lines 120-125 are probably inside of a conditional statement, so that they don't become defined until that conditional statement is true. function definitions should all be grouped together and come near the start of your code or even be in a separate file that gets included near the start of your code. 1 Quote Link to comment Share on other sites More sharing options...
dpenguin71 Posted June 24, 2015 Author Share Posted June 24, 2015 Thank you! I moved the function definition to the top of the file and it worked great. I don't know why I didn't think of that before, but I appreciate the suggestion!! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.