• Michael,
    First of all I have to complement you on the thorough and detailed documentation.
    I am using the [Create Your Own Short Code] and instead of “while ($row = $exp->nextRow())” I changed it to “$row = $exp->nextRow();” as I am only interested in the newest record. After the CF7 submission I re-direct to a new page with the above short code and echo the fields after some processing.
    Would you recommend a different way to access the latest record?
    Is there an option to execute the short code on this new page only when the CF7 form is submitted?

    https://ww.wp.xz.cn/plugins/contact-form-7-to-database-extension/

Viewing 1 replies (of 1 total)
  • Plugin Author Michael Simpson

    (@msimpson)

    WP Documentation recommends that include that while loop to ensure that the database query/connection gets closed when finished. I suggest to keep that in but add limit="1" to the short code to ensure you only have one value in the query result.

    In your scenario, it is possible, although not likely, that two people might submit the form nearly at the same time and by the time the next page displays, both are viewing the same last submission…correct for one person but incorrect for the other.

    Ideally you would want an id returned to CF7 to use when it forwards to the next page and the shortcode would load the values associated with that id. Unfortunately there isn’t a way to integrate with CF7 that closely to achieve that.

Viewing 1 replies (of 1 total)

The topic ‘[Create Your Own Short Code] Advice’ is closed to new replies.