Jump to content

Call to undefined function - but it IS defined... help?


dpenguin71
Go to solution Solved by mac_gyver,

Recommended Posts

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?

Link to comment
Share on other sites

  • Solution

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.

  • Like 1
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.