[[!FomitID]]
<?php $output = ''; $sql = "SELECT id FROM modx_formit_forms ORDER BY id DESC LIMIT 1"; foreach ($modx->query($sql) as $row) { $output .= $row['id']; } print ($output);
I think you might be trying to reinvent the wheel, there are extras for email lists
I am not a php expert myself, but that code looks like its pulling the entire database.
So you've got a formit form, and this is like a user submission? and then its going in the database into a particular field?
We can get you there, but you may need to explain more...
if its a form what you want I think is a posthook, a command to the form to do something after the form is submitted
[[!AjaxForm? &form=`formTpl2` &snippet=`FormIt` &hooks=`recaptchav2,email,FormItSaveForm,FormItAutoResponder` &fieldNames=`name==name, email==email, message==message` &emailTpl=`emailTpl` &emailSubject=`[[++site_name]] Website Enquiry` &emailFrom=`[[+email]]` &emailFromName=`[[+name]]` &emailTo=`[[+addressTo]]` &emailReplyTo=`[[+email]]` &emailReplyToName=`[[+name]]` &fiarTpl=`emailFiarTpl` &fiarSubject=`[[++site_name]] Website Enquiry` &fiarFrom=`[[+addressTo]]` &fiarFromName=`[[++site_name]]` &fiarToField=`email` &fiarReplyTo=`[[+addressTo]]` &fiarReplyToName=`[[++site_name]]` &validate=`name:required, email:email:required, surname:required, contact_number, company_name, courseSelect, placeSelect, addressTo` ]]
<input type="hidden" name="identifier" value="[[!RandomNumber? &formatNumber=`1` &length=`5`]]">
<p>After activating the link, you may in the future login with this password and your username:</p> <p> Username: <strong>[[+username]]</strong><br /> Password: <strong>[[+password]]</strong></p>
SELECT id FROM modx_formit_forms ORDER BY id DESC LIMIT 1