Forum
Contact Form "action" parameter
I have a simple contact form on my site using the Perch Forms addon. When it renders on the site, the form has an "action" parameter:
'action = "/contact.php"'.
This makes it refresh the page once the form is submitted and the response is therefor not tracked. I do not have this in my template. My form tag has:
<perch:form id="contact_form" method="POST" app="perch_forms">
Is there a way to resolve this?
Diagnostics report included:
Perch: 3.0.9, PHP: 7.1.1, MySQL: mysqlnd 5.0.12-dev - 20150407 - $Id: b396954eeb2d1d9ed7902b8bae237b287f21ad9e $, with PDO
Server OS: Darwin, apache2handler
Installed apps: content (3.0.9), assets (3.0.9), categories (3.0.9), perch_forms (1.9.1)
App runtimes: <?php $apps_list = [ 'perch_forms' ];
PERCH_LOGINPATH: /perch
PERCH_PATH: /Users/Jo/Sites/abeng.com/perch
PERCH_CORE: /Users/Jo/Sites/abeng.com/perch/core
PERCH_RESFILEPATH: /Users/Jo/Sites/abeng.com/perch/resources
Image manipulation: GD
PHP limits: Max upload 32M, Max POST 32M, Memory: 128M, Total max file upload: 32M
F1: 3b606135b33e6a102526838f4152a807
Resource folder writeable: Yes
HTTP_HOST: abeng.localhost
DOCUMENT_ROOT: /Users/Jo/Sites/abeng.com
REQUEST_URI: /perch/core/settings/diagnostics/
SCRIPT_NAME: /perch/core/settings/diagnostics/index.php
Thanks for your response, Drew. This doesn't solve the issue. By setting an action, yes the page is redirected elsewhere but the response is still not recorded. Originally, my form had no action parameter and the response would be recorded and then redirected to the page set via the CMS. Can you shed some light on why this is being added automatically or why the responses are not being recorded? Many thanks.
Do you have server side redirects in place? Make sure the action you set is to the result of a redirect, not the source.
So if your server redirects from
/foo
or/foo.php
to/foo/
, make sure you set the action to/foo/
.Otherwise the redirect will discard the posted form data.
Yes, that was it! Adding the action without file extension resolved it.
Thanks for your help!