Unexpected "T-String" ??

Hello:

Created form:

http://www.mythicworldtours.com/test/gsreserve.php

and get this error:

Parse error: syntax error, unexpected T_STRING, expecting ‘]’ in /home/mythicto/public_html/test/gsreserve.php on line 56

Line 56 is this via BBEdit:

<option value=“1”<?php if($f[Number_of Guests]=="1") { echo ' selected'; } ?>>1

I’ve not done anything special here so I’m not sure what that the issue is… Any ideas?

JPW

This is where the error is coming from. You are using array notation
(square brackets) but you have a bare string inside the brackets.
That needs to be in quotes, so put $(f[‘Number_of Guests’] in there.
Also, look closely – you have a space in there as well, so it’s not
going to work on the form side for that reason either. So you really
need to rename your form field to remove the space, probably
‘Number_of_Guests’.

How did you generate the form handler code? Is this from Forms To Go
or similar?

Walter

On Apr 14, 2008, at 9:22 AM, James Wilkinson wrote:

$f[Number_of Guests]


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

This is easiforms from Mike B… and I just created my form normally
and added the action to the elements

James

On Apr-14-08, at 9:30 AM, Walter Lee Davis wrote:

This is where the error is coming from. You are using array notation
(square brackets) but you have a bare string inside the brackets.
That needs to be in quotes, so put $(f[‘Number_of Guests’] in there.
Also, look closely – you have a space in there as well, so it’s not
going to work on the form side for that reason either. So you really
need to rename your form field to remove the space, probably
‘Number_of_Guests’.

How did you generate the form handler code? Is this from Forms To Go
or similar?

Walter

On Apr 14, 2008, at 9:22 AM, James Wilkinson wrote:

$f[Number_of Guests]


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Ok - so putting the “_” between the words did it - but is this
something new? I don’t remember needing to do that before…

Now, however, I can’t get the € symbol to show properly in the drop
down menu options… I’ve tried:

2 Star - 2 Nights - €225 and 2 Star - 2 Nights - "€"225
but neither work… Thoughts?

JPW


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

It’s always been true, a variable name must be a single word. This is
true in any language I have ever used. When you name a form field in
Freeway, there is no coercion to do the right thing the way there is
for IDs. Perhaps this should be a feature request…

Walter

On Apr 14, 2008, at 9:54 AM, James Wilkinson wrote:

Ok - so putting the “_” between the words did it - but is this
something new? I don’t remember needing to do that before…


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

I completely agree - there should be an error pop-up or something to
say that - but it does seem restrictive when you see menu elements on
other sites with spaces - FW should do this for us automagically.
It’s why we use a WYSIWYG app, right?

JPW


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

What does a form element’s name have to do with its value?

The issue here is with the name of the field, which becomes a key in
the POST or GET request array sent to the server by your browser.

In the case of a popup with multiple values, each option of the
select element can have a value that contains spaces. It’s just the
name of the form element that we are concerned with here. That can’t
have any spaces in it if you plan to process it on the server at some
point.

Walter

On Apr 14, 2008, at 11:40 AM, James Wilkinson wrote:

I completely agree - there should be an error pop-up or something to
say that - but it does seem restrictive when you see menu elements on
other sites with spaces - FW should do this for us automagically.
It’s why we use a WYSIWYG app, right?

JPW


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

In a menu list form element, you only have the option for name as the
values are the options people chose when viewing the form online.
This name is what is returned to the form receiver with it’s
corresponding value that was chosen. Asking FW to encode the spaces
that people will most certainly use (like I did) isn’t a lot to ask?
Right?

So the receiver sees this - or should…

Date: May 1-4, 2008
Hotel: 2 Star - 2 Nights - € 225
Number of Guests: 4

JPW


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

HI,
Spaces are allowed in form element names. However if, as in some cases, you use the id atribute instaed of a name, you will run into problems. It is good practice to avoid them at all costs because of the trouble they can cause.

The problem comes down to when the POST or GET data is retrieved at the other end. In James’ example, you do indeed need to put the name in quotes.

$f[‘Number_of Guests’]

and this should work as long as there is a value in the array $f for the key “Number_of Guests”.

However, if you want to use the other method of grabbing the same value:

$f.Number_of Guests

then clearly you are heading for trouble as PHP will be looking for the equivalent of:

$f[‘Number_of’]

with the " Guests" part causing confusion.


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Ok - so where is the issue being generated from then? Is it the
easiform action or FW who is the culprit??? I’m thoroughly
confused… All I’m trying to do is have a form element with spaces
in its name and use the easiform action…

JPW


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

I tried numerous ways to get the form to load without error and used
the following in the name area of the form element area of the
Inspector Window:

“Number of Guests” > Failed
'Number of Guests" > Failed
Number of Guests > Failed
Number_of_Guests > Passed

JPW


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Sorry should have been:

‘Number of Guests’ > Failed

JPW


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

I think you are trying to use spaces in the value, the name of the
field is known (or cared about, anyway) only to the server. Nobody
here has said you couldn’t use spaces in your values. There’s nothing
magical about that.

Do you have another form somewhere that has the EasiForm action
applied, and that is not running in test mode? Because it would be
trivial to pop a new field in there that contained a euro mark and
see if you could see the field properly. That would remove the
EasiForm action from the list of possible problems.

Walter

On Apr 14, 2008, at 12:19 PM, James Wilkinson wrote:

Ok - so where is the issue being generated from then? Is it the
easiform action or FW who is the culprit??? I’m thoroughly
confused… All I’m trying to do is have a form element with spaces
in its name and use the easiform action…

JPW


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

I do not have another site running easiform - this is my first one…
and yes, I know that in the values you can have spaces… it’s the
name of the element. The name is super important as it tells the
receiver of the form info, what was chosen in the form. In my case:

Date: May 1 - 4, 2008
Hotel: 2 Star - 2-Night - €265
Number of Guests: 4
Name: John Smith
Telephone: 555-555-5555

etc.

otherwise if I did not assign a name to an element, the receiver
would get:

item1: May 1-4, 2008
item1a: 2 Star - 2-Night - €265
item1b: 4
item1c: John Smith

etc.

JPW


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Hi James,

The problem is ‘Number_of Guests’, make it ‘Number_of_guests’ and that
should fix it.

BTW, no need to use a capital in Number, easiForm will make the first
letter a capital in the email you receive.

Mike


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

James,

easiForm will remove the underslash from the variable name, so
‘number_of_guests’ set to a value of 10 will show in the email that
you receive as Number of guests: 10

If you are using the easiForm actions the you would just enter
‘number_of_guests’ into the ‘Name’ field in the inspector for the
element and easiForm will do the rest.

Mike

On Apr 14, 2008, at 6:41 PM, James Wilkinson wrote:

I do not have another site running easiform - this is my first one…
and yes, I know that in the values you can have spaces… it’s the
name of the element. The name is super important as it tells the
receiver of the form info, what was chosen in the form. In my case:

Date: May 1 - 4, 2008
Hotel: 2 Star - 2-Night - €265
Number of Guests: 4
Name: John Smith
Telephone: 555-555-5555

etc.

otherwise if I did not assign a name to an element, the receiver
would get:

item1: May 1-4, 2008
item1a: 2 Star - 2-Night - €265
item1b: 4
item1c: John Smith

etc.

JPW


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Oh and yes, ‘number_of_guests’ without the quotes!

On Apr 14, 2008, at 8:35 PM, Mike B wrote:

James,

easiForm will remove the underslash from the variable name, so
‘number_of_guests’ set to a value of 10 will show in the email that
you receive as Number of guests: 10

If you are using the easiForm actions the you would just enter
‘number_of_guests’ into the ‘Name’ field in the inspector for the
element and easiForm will do the rest.

Mike


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

No not in easiForm they won’t, the error is the space.

On Apr 14, 2008, at 3:32 PM, Simon Manning wrote:

String keys require quotation. $f[‘Number_of Guests’]

Hummm… I just tried this on my server and the euro symbol reads OK in the menu, I just typed it from the keyboard into the menu as €.

On 14 Apr. 2008, 1:54 pm, James Wilkinson wrote:

Ok - so putting the “_” between the words did it - but is this
something new? I don’t remember needing to do that before…

Now, however, I can’t get the € symbol to show properly in the drop
down menu options… I’ve tried:

2 Star - 2 Nights - €225 and 2 Star - 2 Nights - "€"225
but neither work… Thoughts?

JPW


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Most likely the issue is that your demo-alert box is appearing before
the opening html tag, so the page is really really invalid. That
might be putting Safari off.

Try this on your server app if the domain isn’t registered:

preg_replace(’/<body(.*?)>/’,"<body$1>$your_alert",$page);

On Apr 14, 2008, at 3:07 PM, Mike B wrote:

Hummm… I just tried this on my server and the euro symbol reads
OK in the menu, I just typed it from the keyboard into the menu as
€.

On 14 Apr. 2008, 1:54 pm, James Wilkinson wrote:

Ok - so putting the “_” between the words did it - but is this
something new? I don’t remember needing to do that before…

Now, however, I can’t get the € symbol to show properly in the drop
down menu options… I’ve tried:

2 Star - 2 Nights - €225 and 2 Star - 2 Nights - "€"225
but neither work… Thoughts?

JPW


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options