0

can anyone offer some help on this matter
i have 5 session arrays and i want to merge all of them. however these session arrays are take from several multiple select list. while the code that i have done so far works fine, it has one small problem. in the event that some one does not uses one of the list thus one of the sessions arrays will be empty thus the merge of the other arrays will not take place can anyone offer some ideas on how to solve this problem
here is the code that i have done thus far

$new=array_merge($_SESSION['y1sem1'],$_SESSION['y2sem1'],$_SESSION['y3sem1']);

					print_r($new);

thanks

4
Contributors
3
Replies
4
Views
7 Years
Discussion Span
Last Post by as.bhanuprakash
0
if (isset($_SESSION['y1sem1']))
	$new=array_merge($_SESSION['y1sem1']);
	
if (isset($_SESSION['y2sem1']) && isset($new))
	$new=array_merge($new,$d_SESSION['y2sem1']);
elseif (isset($_SESSION['y2sem1']) && !isset($new))
	$new=array_merge($_SESSION['y2sem1']);

if (isset($_SESSION['y3sem1']) && isset($new))
	$new=array_merge($new,$_SESSION['y3sem1']);
elseif (isset($_SESSION['y3sem1']) && !isset($new))
	$new=array_merge($_SESSION['y3sem1']);

Edited by urtrivedi: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.