PHPBB validate_data giving me a server error

I'm sure this will be a very simple issue to solve but I can't get my head around what's going wrong.

I have the following code when the form is submitted.

$error = array();

  $data = array(
    'recipe_name'      => utf8_normalize_nfc(request_var('recipe_name', '', true)),
    'recipe_desc'        => utf8_normalize_nfc(request_var('recipe_desc', '', true)),
  );

  // Validate user input
  $validate_array = array(
     'recipe_name'         => array('string', true, 5, 25),
     'recipe_desc'         => array('string', true, 5, 25),
  );


  $error = validate_data($data, $validate_array); 

recipe_name contains "name test" recipe_desc contains "desc test"

When I submit the form I get a server error.

Where am I going wrong? I've searched for examples on validating data but I still can't pinpoint what I'm doing wrong.

Adding var_dum($data) gives

array(2) { ["recipe_name"]=> string(4) "test" ["recipe_desc"]=> string(7) "testing" }

Adding var_dump($validate_array) gives

array(2) { ["recipe_name"]=> array(4) { [0]=> string(6) "string" [1]=> bool(true) [2]=> int(5) [3]=> int(10) } ["recipe_desc"]=> array(4) { [0]=> string(6) "string" [1]=> bool(true) [2]=> int(5) [3]=> int(25) } }

Answers


I hadn't included the user functions page in mine, so wasn't able to access the function, hence causing the server error. Knew it had to be something simple.

include($phpbb_root_path . 'includes/functions_user.' . $phpEx);

Adding the above fixed the problem.


Need Your Help

Can't fadeOut element created with JavaScript

javascript jquery click fadeout

I'm trying to get the rounded rectangle to fade out on click.. anyone know why it's not working? If you go to the fiddle, click the "+" icon, enter in a hex code, then exit using the "x" in the top

JSOUP not downloading complete html if the webpage is big in size. Any alternatives to this or any workarounds?

java html html-parsing jsoup

I was trying to get the HTML page and parse information. I just found out that some of the pages were not completely downloaded using Jsoup. I checked with curl command on command line then the com...