What my script currently does:
- grabs & cleans a $_GET['id']
- pulls all pre-existing data from TABLE for that id
- displays form populated with any pre-existing data
- SUBMIT sends form data to update script, adds all data to TABLE
What I want my script to do:
- grabs & cleans a $_GET['id']
- pulls all possible (id)'s from TABLE (this I know how to do)
- checks that
$_GET['id']
is in array ID (this I know how to do) - IF NOT, kill script, do not display form, and echo error message (this I don't)
- IF YES, proceed as normal
- pulls all pre-existing data from TABLE for that id
- displays form populated with any pre-existing data
- SUBMIT sends form data to update script, adds all data to TABLE
Current script structure:
- php code
- html form with
<?php _ ?>
inserts for all values
I've tried to be a good lad and separate my code, and have largely succeeded. But that's left me with the problem that my html form displays whether the $_GET['id']
is legit or not.
Could someone please help me set it up so that if (!in_array($id, $allIDs))
prevents the form from displaying and tosses out an error instead?
Other than making the form an echoed HEREDOC, is there a way to control the display of that html?
Psuedocode is acceptable. I didn't bother posting my actual code because I didn't think the problem really merited such specificity. I can if need be...