Validate field against database

What would be the best way to validate a field entry against a database? For example, a customer registers a new product with a serial #. That serial # (and the rest of customer info) gets stored in a database. The customer comes back some time later to do a warranty request. There’s one form field visible asking them for their serial #. The customer types in their serial # and clicks continue. The form then checks the database to see if that serial # exists. If it does, it shows the rest of the form fields to fill out. If it doesn’t, an error message informs them that serial# doesn’t exist.
Would this function be done through Gravity Forms and Zapier or Webhooks or something else?

I did find this: https://pastebin.com/7ANQh6Rc
How would that need to be modified to access a WordPress database as opposed to a .txt file?

To modify that code to refer to a database rather than a text file would require you write the code to connect to the database to perform the validation.

This plugin can handle that scenario out of the box:

If you are open to using that plugin, I recommend contacting Gravity Wiz to ask them how this can be accomplished. Thank you.

1 Like