Forum

Thread tagged as: Problem, Error

perch_forms() not being found with v3.0

For my latest project we are using the newest version of perch, but the perch forms won't submit, and the php_error.log says that the function cannot be found:

PHP Fatal error:  Uncaught Error: Call to undefined function perch_forms()

I had a similiar problem with the blog app, but when I reinstalled the files it started to work. I have done the same with the forms, but still the same error.

Here is the diagnostics:

Perch LTM: 3.0.8
Production mode: Production (100)
Installed apps: content (3.0.8), assets (3.0.8), categories (3.0.8), perch_blog (5.5.1), perch_forms (1.9.1)
DB driver: PDO
DB tables: perch3_blog_authors (18), perch3_blog_comments (0), perch3_blog_index (6267), perch3_blog_posts (234), perch3_blog_posts_to_tags (28), perch3_blog_sections (1), perch3_blog_tags (17), perch3_blogs (1), perch3_categories (10), perch3_category_counts (4), perch3_category_sets (1), perch3_content_index (196), perch3_content_items (82), perch3_content_regions (104), perch3_forms (0), perch3_forms_responses (0), perch3_menu_items (10), perch3_navigation (1), perch3_navigation_pages (8), perch3_page_templates (5), perch3_pages (59), perch3_resource_log (62), perch3_resource_tags (0), perch3_resources (39), perch3_resources_to_tags (0), perch3_settings (15), perch3_user_passwords (0), perch3_user_privileges (40), perch3_user_role_privileges (2), perch3_user_roles (2), perch3_users (1)
Users: 1
App runtimes:
<?php
    $apps_list = [
        'perch_blog',
        'perch_forms'
    ];
Scheduled tasks for perch_blog: delete_spam_comments (1440 mins)
Editor plug-ins: ckeditor
H1: 421aa90e079fa326b6494f812ad13e79
L1: 00b88a19498d3cd34cc8f92156a714e9
F1: 0c66c2e1f82f9e0b7617b2cb8270f2c7
headerColour: #ffffff
content_singlePageEdit: 1
helpURL:
siteURL: /
hideBranding: 0
content_collapseList: 1
lang: en-gb
installedAt: 3.0.4
update_3.0.4: done
latest_version:
on_sale_version: 3.0.8
perch_blog_update: 5.0.1
perch_blog_post_url: /blog/post.php?s={postSlug}
update_3.0.6: done
update_3.0.8: done
PERCH_DEVELOPMENT: 10
PERCH_STAGING: 50
PERCH_PRODUCTION: 100
PERCH_DB_USERNAME: root
PERCH_DB_SERVER: localhost
PERCH_DB_DATABASE: itfutures
PERCH_DB_PREFIX: perch3_
PERCH_TZ: UTC
PERCH_EMAIL_FROM: locky@moworks.com.au
PERCH_EMAIL_FROM_NAME: Dev Moworks
PERCH_LOGINPATH: /perch
PERCH_PATH: /Users/nathan/Documents/LOCAL/clients/itfutures/www/perch
PERCH_CORE: /Users/nathan/Documents/LOCAL/clients/itfutures/www/perch/core
PERCH_RESFILEPATH: /Users/nathan/Documents/LOCAL/clients/itfutures/www/perch/resources
PERCH_RESPATH: /perch/resources
PERCH_HTML5: 1
PERCH_DEBUG: 1
PERCH_RUNWAY:
PERCH_ERROR_MODE: DIE
PERCH_DATE_LONG: %d %B %Y
PERCH_DATE_SHORT: %d %b %Y
PERCH_TIME_SHORT: %H:%M
PERCH_TIME_LONG: %H:%M:%S
PERCH_RUNWAY_ROUTED:
PERCH_STRONG_PASSWORDS:
PERCH_ASSET_VERSION: 5163d57ff611b3cf853b
PERCH_PREVIEW_ARG: preview
PERCH_TEMPLATE_PATH: /Users/nathan/Documents/LOCAL/clients/itfutures/www/perch/templates
PERCH_TEMPLATE_FILTERS:
PERCH_DEFAULT_DOC: index.php
PERCH_DEFAULT_EXT: .php
PERCH_PRODUCTION_MODE: 100
PERCH_XHTML_MARKUP:
PERCH_RWD: 1
PERCH_HTML_ENTITIES:
PERCH_SSL:
PERCH_STRIPSLASHES:
PERCH_PROGRESSIVE_FLUSH: 1
PERCH_PARANOID:
PERCH_FORCE_SECURE_COOKIES:
PERCH_DEFAULT_BUCKET: default
PERCH_TRANSLATION_ASSIST:
PERCH_PASSWORD_MIN_LENGTH: 6
PERCH_MAX_FAILED_LOGINS: 10
PERCH_AUTH_LOCKOUT_DURATION: 1 HOUR
PERCH_VERIFY_UPLOADS:
PERCH_PRIV_ASSIST:
PERCH_CUSTOM_EDITOR_CONFIGS:
PERCH_AUTH_PLUGIN:
PERCH_DB_CHARSET: utf8
PERCH_DB_PORT:
PERCH_DB_SOCKET:
PERCH_APPS_EDITOR_PLUGIN: markitup
PERCH_APPS_EDITOR_MARKUP_LANGUAGE: markdown
Hosting settings

PHP: 7.0.0
Zend: 3.0.0
OS: Darwin
SAPI: apache2handler
Safe mode: not detected
MySQL client: mysqlnd 5.0.12-dev - 20150407 - $Id: 7e72f9690b1498a1bead7a637c33a831c0d2f655 $
MySQL server: 5.5.42
Free disk space: 812.89 GB
Extensions: Core, date, libxml, openssl, pcre, sqlite3, zlib, bcmath, bz2, calendar, ctype, curl, dom, hash, fileinfo, filter, ftp, gd, SPL, iconv, intl, json, ldap, mbstring, session, standard, mysqlnd, PDO, pdo_mysql, pdo_sqlite, Phar, posix, Reflection, mysqli, SimpleXML, soap, sockets, exif, tokenizer, wddx, xml, xmlreader, xmlwriter, xsl, zip, apache2handler, imap, mcrypt, pgsql, pdo_pgsql
GD: Yes
ImageMagick: No
PHP max upload size: 32M
PHP max form post size: 32M
PHP memory limit: 128M
Total max uploadable file size: 32M
Resource folder writeable: Yes
Session timeout: 24 minutes
Native JSON: Yes
Filter functions: Yes
Transliteration functions: Yes
HTTP_HOST: localhost:8888
HTTP_CONNECTION: keep-alive
HTTP_UPGRADE_INSECURE_REQUESTS: 1
HTTP_USER_AGENT: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36
HTTP_ACCEPT: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
HTTP_REFERER: https://localhost:8888/perch/core/settings/diagnostics/
HTTP_ACCEPT_ENCODING: gzip, deflate, sdch, br
HTTP_ACCEPT_LANGUAGE: en-US,en;q=0.8
HTTP_COOKIE: bolt_authtoken_4cc54362930cb26261be0e29e6ad4a77=6e3bfbe8763050e4c29faa31e10bb936; bolt_session_4cc54362930cb26261be0e29e6ad4a77=pHJTRDp2n7ob7dJozTOsiEdmbtwQOmcB; _hjIncludedInSample=1; SQLiteManager_currentLangue=2; PHPSESSID=0e21604ba70eb06bd75d094f6db4ffc5; cmsa=1; io=WfmTed6REAHjxCOXAAAl
PATH: /usr/bin:/bin:/usr/sbin:/sbin
SERVER_SOFTWARE: Apache/2.2.29 (Unix) mod_wsgi/3.5 Python/2.7.10 PHP/7.0.0 mod_ssl/2.2.29 OpenSSL/0.9.8zh DAV/2 mod_fastcgi/2.4.6 mod_perl/2.0.9 Perl/v5.22.0
SERVER_NAME: localhost
SERVER_ADDR: ::1
SERVER_PORT: 8888
REMOTE_ADDR: ::1
DOCUMENT_ROOT: /Users/nathan/Documents/LOCAL/clients/itfutures/www
SERVER_ADMIN: you@example.com
SCRIPT_FILENAME: /Users/nathan/Documents/LOCAL/clients/itfutures/www/perch/core/settings/diagnostics/index.php
REMOTE_PORT: 59942
GATEWAY_INTERFACE: CGI/1.1
SERVER_PROTOCOL: HTTP/1.1
REQUEST_METHOD: GET
QUERY_STRING: extended
REQUEST_URI: /perch/core/settings/diagnostics/?extended
SCRIPT_NAME: /perch/core/settings/diagnostics/index.php
PHP_SELF: /perch/core/settings/diagnostics/index.php
REQUEST_TIME_FLOAT: 1497404453.1
REQUEST_TIME: 1497404453
argc: 1

The form is a simple contact form, no file uploads or anything.

Is perch forms handled differently in the new version?

edit: I also get this from the debugger on the perch forms section in the dashboard:

Debug Message - Perch 3.0.8
[1] SELECT u.*, r.* FROM perch3_users u, perch3_user_roles r WHERE u.roleID=r.roleID AND u.userEnabled=1 AND u.userID=1 AND u.userHash='8ce923ff903e1f9a12b243a77122b4e5' LIMIT 1
UPDATE perch3_users SET userHash='a9e4f590ba4070b1df73d27d9521b3bc' WHERE userID='1'
[40] SELECT p.privKey FROM perch3_user_privileges p
[15] SELECT settingID, settingValue, userID FROM perch3_settings WHERE userID=1 OR userID=0 ORDER BY userID ASC
[8] SELECT itemValue FROM perch3_menu_items WHERE itemType='app'
[nil] SELECT * FROM perch3_forms
Attempting app installation: perch_forms
[1] SHOW TABLES LIKE "perch3_forms"
[1] SELECT * FROM perch3_menu_items WHERE itemActive=1 AND itemType='menu' AND parentID=0 ORDER BY itemOrder ASC LIMIT 0, 1
[3] SELECT mi.*, p.privKey FROM perch3_menu_items mi LEFT JOIN perch3_user_privileges p ON mi.privID=p.privID WHERE mi.itemActive=1 AND mi.parentID=1 ORDER BY mi.itemOrder ASC
[1] SELECT itemTitle FROM perch3_menu_items WHERE itemType='app' AND itemValue='perch_forms' LIMIT 1
[1] SELECT * FROM perch3_menu_items WHERE itemActive=1 AND itemType='menu' AND parentID=0 ORDER BY itemOrder ASC LIMIT 1, 10
[2] SELECT mi.*, p.privKey FROM perch3_menu_items mi LEFT JOIN perch3_user_privileges p ON mi.privID=p.privID WHERE mi.itemActive=1 AND mi.parentID=2 ORDER BY mi.itemOrder ASC
File: /addons/apps/perch_forms/modes/forms.list.post.php
Queries: 13
Memory: 1.9181
Locky Keaney

Locky Keaney 0 points

  • 4 years ago

You should be using

perch_form('myFancyForm.html')

Not perch_forms()... there is no perch_forms function.

https://docs.grabaperch.com/functions/form/perch-form/

I am using that on the page:

<?php perch_form('contact.html'); ?>

I'm getting the error in the MAMP php error logs.

edit: And now nothing is showing up in the error logs for some reason. Submitting the form still does not make is show in the dashboard.

here is the template:

<section class="section contact-form">
  <div class="section__inner">

    <perch:form id="contactForm" method="post" app="perch_forms">

      <p class="text-small space-bottom--double">Send us a message</p>

      <perch:input id="contactInterest"
                      label="Inquiring About"
                      type="select"
                      options="Option 1, Option 2, Option 3, Option 4"
                      name="contact-inquire"
                      placeholder="I would like to know more about:"
                      required="true" />

      <div class="input__container">
        <perch:label class="input__text-label">Your name</perch:label>
        <perch:input id="contactFirstName" class="input__text-field" label="First Name" type="text" name="first-name" placeholder="First Name" required="true" />
      </div>

      <div class="input__container">
        <perch:label class="input__text-label">Phone number</perch:label>
        <perch:input id="contactPhoneNumber" class="input__text-field" label="Phone Number" type="text" name="phone-number" placeholder="Phone Number" required="true" />
      </div>

      <div class="input__container">
        <perch:label class="input__text-label">Your email</perch:label>
        <perch:input id="contactEmailAddress" class="input__text-field" label="Email Address" type="email" name="email-address" placeholder="Email Address" required="true" />
      </div>

      <div class="input__container input__container--textarea space-bottom--double">
        <perch:label class="input__text-label">Your message</perch:label>
        <perch:input id="contactMessage" label="Message" type="textarea" name="message" placeholder="Leave us a message" require="true" />
      </div>

      <perch:input id="contactSubmit" type="submit" value="Submit" class="button button--cta" />

    </perch:form>

  </div>
</section>
Drew McLellan

Drew McLellan 2638 points
Perch Support

What does debug say now after you submit the form?