Developer Support »

X and Y values submitted from form

You might notice X and Y values being submitted from your form, and you might be wondering where they came from! You will see them in the email you receive, like this:

X: 5
Y: 18

These are submitted from your form if you are using an image as a submit button as opposed to a conventional submit button. They are the x and y mouse coordinates of where the user clicked on the submit image and are sent by the browser.

If you do not wish to receive these values then you can choose to ignore them if using the Pro version of the script. If using the free version you will have to put up with them (for all it is) or change the image submit button on your form to a conventional submit button like this:

<input type="submit" value="Send">

If using the Pro version of the script you can ignore the values by entering them in the array of ignored fields (or by using an email template). You will find instructions in the script about how to enable this and list the fields to ignore but in short you must enable it thus:

$ignore_fields = 1;

You must then include the x and y fields in the array of fields to ignore, like so:

$fields_to_ignore = array('x','y');

The above example is set up to ignore only the x and y inputs but in practise you might have other values in there too.

Note. As with all field names on your form, these inputs are case sensitive, so you might need to put them in upper case. No harm in doing both, like this:

$fields_to_ignore = array('x','y','X','Y');

You might also see inputs like "submit_x" and "submit_y". Again, just put them in the array, like this for example.

$fields_to_ignore = array('x','y','X','Y','submit_x','submit_y');

By default, the script capitalizes the first letter of the key and replaces underscores with a space, in the key/value pairs returned (this is to make the resultant email easier to read). PHP also ADDS an underscore for a space in a submitted key (field name) so it might not be obvious what to put in the ignore fields array. Suppose you get this in the email:

ImageField2 x: 118
ImageField2 y: 35

Put these values in the array:

$fields_to_ignore = array('ImageField2 x','imageField2 x','ImageField2_x','imageField2_x','ImageField2 y','imageField2 y','ImageField2_y','imageField2_y');

By doing the above, you will be certain to catch them!

That's it, no more unwanted x and y inputs!

It should also be noted that these values will allow an apparently blank form to be sent as PHP sees them as valid input, which effectively they are. If this is a problem for you, you can use the Pro version of the script and set required fields.