I have an array getting to from jquery to my php page, into total they are 20 strings in the array, some of which are empty.
an example if one of the array
array(2) {
[0]=>
string(2) "KI"
[1]=>
string(2) "GY"
}
In php I get the array like
if (isset($_POST[access_array])) {
$access = isset($_POST[access_array]) ? $_POST[access_array] :NULL ;
}
and they I check to see if it is empty like
foreach( $access as $key => $value ) {
if( is_array( $value ) ) {
foreach( $value as $key2 => $value2 ) {
if( empty( $value2 ) )
unset( $access[ $key ][ $key2 ] );
}
}
if( empty( $access[ $key ] ) )
unset( $access[ $key ] );
}
what I am trying to do now is, access those strings in the array into variables like
$array_string1 =
$array_string2 =
$array_string3 =
$array_string4 =
$array_string5 =
blah
blah
$array_string20 =
and then check to see if any of the $array_string
(s) is empty before running an insert statement which will store the data like
table: lvl
id name arraystring
1 john 'HI','HT','OP' <---- that is just any example so HI will be `$array_string1`, HT `$array_string2` or `$array_string18`. Something like that.
The issue I am facing how is separating the strings in the array into those $array_string
(s) variables.
I have seen similar questions(same title) but no specify answers