How to Validate a South African ID Number With PHP

Hi nice website.

Line 102 should be, $verify_check_digit = (10 – (int)$last_digit) % 10;

Hey Ruan. Thanks for the suggested correction. I've updated the code in the post.

Any way I can use this on an existing form and take the age and gender values to populate existing fields?

Yes of course. Check the function I used in the WordPress plugin, here. You could do something like that but instead of what I did, you could output the HTML as HTML inputs. Alternatively, you could call this function via an Ajax call if you need to do this without reload. Let me know if this helps. I'd be happy to write a post covering this.

Leave a Comment

Your email address will not be published. Required fields are marked *

© Copyright 2020 BluSilva (Pty) Ltd. All rights reserved. Privacy & Cookies