danabase Posted August 23, 2009 Posted August 23, 2009 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?
Baloo Posted August 26, 2009 Posted August 26, 2009 (edited) 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, 2009 by Guest
danabase Posted September 9, 2009 Author Posted September 9, 2009 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
Newbies A-Solutions Posted March 31, 2011 Newbies Posted March 31, 2011 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
danabase Posted April 1, 2011 Author Posted April 1, 2011 The code is in the fmview.php file. Just search the code for getinputchoices.
Recommended Posts
This topic is 5324 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now