Well, the script is on my laptop next to this PC, which is unable to communicate with my laptop ... 🙁 So I can't show you the script (and, it's too big to re-type 😉
I'm using
if ($_GET['id']) ...
BUT, also note that add.php will (on submit()) call itself (form action="add.php")
Then, checks if all the $_POST's are correct (through all sorts of validation), and then it will add/update to database.
So, when adding, it will 1st load add.php, then when you click on submit will load add.php again. If everything went successfull it will redirect to another page, if not, it shows add.php's form with custom errors 🙂
So when clicking on submit (while url end with ?id=) it will reload to add.php (where URL does not end in id?= anymore...) and THEN add to database.
Since the id?= is gone, the script ignores if($_GET['id'])...