[FX.php List] Spaces in Field Names...one more time with gusto
Kevin Futter
kfutter at sbc.vic.edu.au
Tue Dec 9 15:32:36 MST 2008
On 10/12/08 9:21 AM, "Jonathan Schwartz" <jschwartz at exit445.com> wrote:
> 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">
Jonathan,
Spaces are not allowed in the 'name' attribute for form fields (they're not
allowed to start with numbers either, FWIW). You'll need to add a
replacement character and then parse them out as part of your normal form
processing. The simplest thing is to not base the form's 'name' attribute
value on the name of the FileMaker field. Just parse the POST data and
convert it there.
Quick example:
<input name="Alpha_Beta">
$fmFieldData = $_POST['Alpha_Beta'];
$FMQuery->SetDBData('Alpha Beta', $fmFieldData);
This is really how you should do it anyway. There's no real need to tie DB
field names to the 'name' attribute value, and in fact you probably
shouldn't for security reasons. That's what form processing is for!
If you're sucking field names out of FM to populate the 'name' attribute,
you'll have to parse them for illegal characters too.
--
Kevin Futter
Webmaster, St. Bernard's College
http://www.sbc.melb.catholic.edu.au/
#####################################################################################
This e-mail message has been scanned for Viruses and Content and cleared
by MailMarshal
#####################################################################################
This e-mail and any attachments may be confidential. You must not disclose or use the information in this e-mail if you are not the intended recipient. If you have received this e-mail in error, please notify us immediately and delete the e-mail and all copies. The College does not guarantee that this e-mail is virus or error free. The attached files are provided and may only be used on the basis that the user assumes all responsibility for any loss, damage or consequence resulting directly or indirectly from the use of the attached files, whether caused by the negligence of the sender or not. The content and opinions in this e-mail are not necessarily those of the College.
More information about the FX.php_List
mailing list