I'm working on a form where it checks to see if data was entered into each form field. If a field is blank, I want the form to show again, but I want data entered in the other fields to be preserved. I want to use an extract() like function...but my variables are not in array. Is there another function that I can use to extract variables and not an array?
Thanks for your help!
Extract function for non arrays.
Moderator: General Moderators
Re: Extract function for non arrays.
Did you read what the php manual says about extract?
Anyway, you don't need extract or any other function. Instead, I'd better write your own functions to validate the data and process it accordingly.Warning
Do not use extract() on untrusted data, like user-input ($_GET, ...). If you do, for example, if you want to run old code that relies on register_globals temporarily, make sure you use one of the non-overwriting extract_type values such as EXTR_SKIP and be aware that you should extract in the same order that's defined in variables_order within the php.ini.
Re: Extract function for non arrays.
Very simply use if($_POST['data1'] && $_POST['data2'] && $_POST....)
it will check to make sure everything is "true" or has had information entered.
-Omni
it will check to make sure everything is "true" or has had information entered.
-Omni