<form action="/submit-page.html" method="POST"> <label>First Name <input type="text" name="firstname" /></label> [[getImageList? &tvname=`myMIGXtv` &tpl=`@CODE:<label>[[+name]] <input name="[[+id]]" type="number"></label> ]] <button type="submit">Send</button> </form>
[[!form-processor]]
<?php $name = $_POST['name']; $body = ' <p> Name: '.$name.'<br> </p> ';
<?php $name = $_POST['name']; [[getImageList? &tvname=`myMIGXtv` &tpl=`@CODE: $[[+id]] = $_POST['[[+name]]']; `]] $body .= ' <p>Name: '.$name.'</p> [[getImageList? &tvname=`myMIGXtv` &tpl=`@CODE: [[+name]]: '.$[[+id]].'</br> `]] </p>';
This question has been answered by Ysanmiguel. See the first response.
[[!FormIt? &hooks=`form-processor`]] <form action="[[~[[*id]]]]" method="post"> <label>First Name <input type="text" name="firstname" /></label> [[getImageList? &tvname=`myMIGXtv` &tpl=`@CODE:<label>[[+name]] <input name="[[+id]]" type="number"></label> ]] <button type="submit">Send</button> </form>
// Get values $values = $hook->getValues(); $log = print_r($values, true); $this->modx->log(modX::LOG_LEVEL_ERROR, 'Values: ' . $log); return true;
$name = $_POST['name'];
$body .= ' <p>Name: '.$name.'</p> ';
foreach ($_POST as $key => $value) { $this->modx->log(modX::LOG_LEVEL_ERROR, 'Key is: ' . $key . ' Value is: ' . $value); }
FormIt would be the more natural choice for forms, and I highly recommend formalicious from modmore also for giving your client control over their forms and adding in additional fields, and field types.
If you want to stick with migx though you should be able to capture anything posted to the page/snippet with this:
foreach ($_POST as $key => $value) { $this->modx->log(modX::LOG_LEVEL_ERROR, 'Key is: ' . $key . ' Value is: ' . $value); }
Someone else may be able to suggest something better but you can maybe prefix your migx values with something and then in the hook use stringpos to match the values that have the prefix and then pull them out into something you can use.
Cool, glad you got it sortedMate, thanks a lot for your time and help, cheers!