August 23, 200916 yr I have been debugging an issue that i have with a PHP form connected to FileMaker and have narrowed the issue to my function. I am new to PHP forms, and I think this might be a relatively easy fix, but am not sure how to approach it. Here is the issue: When I have a field getting a value list from FMP, and the value list has a strings (with spaces) as one value, the values appear on the form, but if I check the box, save, and return to the form, the value with a space between words is unchecked. On exaiming the FMP field in the filemaker, the data is there. There seems to be an issue with the function getInputChoices echoing the string, although the value is checked in filemaker. Here is the function: function getInputChoices($type, $valuelist, $fieldvalue, $fieldName) { $selected = ""; $fieldValueArray = explode(" ", str_replace("n"," ", $fieldvalue)); foreach ($valuelist as $eachvalue) { if (in_array(trim($eachvalue), $fieldValueArray)){ $selected = " checked"; }else{ $selected = ""; } if ($type == "checkbox"){ echo "$eachvalue"; }else{ echo "$eachvalue"; } } } I am not sure if it has to do with the $eachvalue only referring to the first word of the value list line, or something else. Suggestions?
August 26, 200916 yr This is your problem. $fieldValueArray = explode(" ", str_replace("n"," ", $fieldvalue)); You're replacing FMP's newline value delimiter with a space and then telling php to use spaces as the delimiter for setting up the array. Why not just use the following? $fieldValueArray = explode("n",$fieldvalue); Edited August 26, 200916 yr by Guest
September 9, 200916 yr Author Hey Baloo, This worked perfectly - thanks so much! I am just getting my feet wet with php, so things like this help me to understand it a little more. Thanks again, -dana
March 31, 201114 yr Newbies Hi guys, i would also want to change this function, where do you find it? i've been looking in filemaker.php but without succes :s grtz
April 1, 201114 yr Author The code is in the fmview.php file. Just search the code for getinputchoices.
Create an account or sign in to comment