[FX.php List] A little help with strings and arrays
Steve Bennett
steve at bentechaps.com
Mon Mar 19 19:20:44 MDT 2007
Well it has been a fairly productive day building and testing
checkboxes and the "\r\n" is working well but now I get the following
two error lines when the user does not check any of the values which
I assume returns an empty array which can not be imploded.
Notice: Undefined index: category in /Users/webuser/Sites/
ManagerSiteTest/managersitetest/add_result.php on line 4
Warning: implode() [function.implode]: Bad arguments. in /Users/
webuser/Sites/ManagerSiteTest/managersitetest/add_result.php on line 4
So my ready today has been about isset which I am thinking I can to
use to check if the array should be imploded.
The current code which works without error as long as their are no
empty arrays:
$add_result_fields = array('name'=>$_POST['name'],'category'=>implode
("\r\n",$_POST['category']),'amount'=>$_POST['amount'],);
I have been trying change:
'category'=>implode ("\r\n",$_POST['category'])
To use isset to check if there is data in the $_POST['category']
variable and implode it.
'category'=> if(isset($_POST['category'])){implode ("\r\n",$_POST
['category'])}
but I get the following error:
Parse error: syntax error, unexpected T_IF
Thanks,
Steve
On Mar 19, 2007, at 10:24 AM, Gjermund Gusland Thorsen wrote:
> \r\n is what I use with FileMaker platform regardless.
>
> ggt667
>
> On 3/19/07, Derrick Fogle <derrick at fogles.net> wrote:
>> Actually, on Mac systems (both Apache/PHP and FM on Macs), you need
>> to just send \r. The \n will either be discarded or turn into a
>> garbage character.
>>
>> On Mar 19, 2007, at 9:08 AM, Andrew Denman wrote:
>>
>> > * I believe the "\r\n" line separators will work on Mac (it
>> > definitely works
>> > on Windows), but if it doesn't work for you on Mac try just "\n".
>>
>>
>> Derrick Fogle
>> derrick at fogles.net
>>
>>
>>
>> _______________________________________________
>> FX.php_List mailing list
>> FX.php_List at mail.iviking.org
>> http://www.iviking.org/mailman/listinfo/fx.php_list
>>
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list
>
More information about the FX.php_List
mailing list