I'm reposting this as I added it on to my previous post and the title of that post - to do with postcodes - doesn't really reflect the nature of the problem. Which is:
My form looks up and validates a bank sort code and account number. It works fine as a standalone php form but it's not clear to me how to use formit and a snippet to achieve the same result. (ultimately, I want to use formit to email all the values as a spreadsheet - which works just fine as well)
The form, stripped down, is:
<label for="sortcode">Sort Code<span class="error">[[!+fi.error.sortcode]]</span></label>
<input type="text" name="sortcode" value='<?php if(isset($_POST['sortcode'])) { echo htmlentities ($_POST['sortcode']); }?>' /> // set to retain the input in the input field
<label for="AccountNumber">Account Number</label>
<input type="text" name="AccountNumber" value='<?php if(isset($_POST['AccountNumber'])) { echo htmlentities ($_POST['AccountNumber']); }?>' /> // set to retain the input in the input field
<input class="button" name="click" type="submit" value="Check bank account details" />
PHP
if(isset($_POST['click']))
{
$sortcode = $_POST['sortcode'];
$AccountNumber = $_POST['AccountNumber'];
.
> external database call, which returns array
.
$data = $pa->HasData();
foreach ($data as $item)
{
$varVerifyAccount = $item["AccountVerification"];
more items from array...
So the external call checks the account and we use $varVerifyAccount to advise the user whether or not the account may be used. You can see how the form looks here:
http://pfsmedia.net/letusfixit/account-form.php
Can someone give me a steer how to code the snippet? Also, you can see I'm keen to retain the values in the input fields after submit is clicked. Not sure how to do that in formit either.
Thanks