[FX.php List] Spaces in Field Names...one more time with gusto

Troy Meyers tcmeyers at troymeyers.com
Tue Dec 9 15:39:39 MST 2008


J,

This is what I was alluding to in my prior post.

I recommend that you DON'T treat input fields as same-name entities as FileMaker fields.

Have:
<input name="alphabeta" />
...in your form instead, then in the PHP that sets up the query, have something like:
if (isset($_POST['alphabeta'])) {
     $your_find->AddDBParam('Alpha Beta','=='.$_POST['alphabeta'])
}

This way you not only keep the difference between form field names and values divorced from the FileMaker field names --until you want them associated-- but you also give away fewer clues about how to hack your pages, and have much stronger control over what can and can't be done with your page.

-Troy


> ggt,
> 
> Each one of the URLs below work.  That is, when the command to FMP is 
> issued to via URL all is fine, whether the space in the field name is 
> replaced with "%20" or "+", FMP responds appropriately.
> 
> So that's not the problem.
> 
> The problem is the step before: When fields with spaces in their  names
> are POSTed via a FORM,  the resulting POST is automatically  replacing
> the space with an underline:
> 
>  From the Form:
> 
> 		<input name="Alpha Beta">
> 
> From the POST Array:
> 
> 	Array
> 
> (
> 
> 	[Alpha_Beta] => John Smith
> 
> )
> 
> 	Notice "Alpha Beta" (with space)  field name is POSTed as 
> "Alpha_Beta" (with underline).
> 
> I'm observing this using a print_r($_POST);  command.
> 
> So, when I build an Fx.php  query, it does so with "Alpha_Beta" (with 
> underline) and an error 102 is produced because the field in FMP is 
> "Alpha Beta (no underline).
> 
> That is the base problem.
> 
> Not sure why I'm the only one with this problem.  I've always dealt 
> with the problem by redefining FMP Field names to eliminate spaces.  No
> longer have that luxury.
> 
> So...where do insert urlencode or str_replace?
> 
> I tried this:
> 
> 	<input name =<?php urlencode('Alpha Beta');?>">
> 
> and it did produce this POST:
> 
> Array
> 
> (
> 
> 	[Alpha+Beta] => John Smith
> 
> )
> 
> But that post produced this URL, and of course failed with the same 
> 102 error (note the %2B):
> 
> http://.....Alpha%2BBeta=John+Smith....
> 
> I'm trying!
> 
> J



More information about the FX.php_List mailing list