Lionel
01-06-2006, 08:21 PM
I have six textboxes on a page.
For the db insert I do
$preddata1 = serialize((is_array($_POST['predminutes1']) ? $_POST['predminutes1']: array()));
and I insert $preddata1.
Results inserted in db are as below
a:6:{s:10:"0000000031";s:2:"25";s:10:"0000000032";s:0:"";s:10:"0000000033";s:2:"35";s:10:"0000000034";s:0:"";s:10:"0000000035";s:0:"";s:10:"0000000036";s:0:"";}
As you can see the array only has 2 values "25" and "35".
How can I prevent the other empty values to be recorded?
For the db insert I do
$preddata1 = serialize((is_array($_POST['predminutes1']) ? $_POST['predminutes1']: array()));
and I insert $preddata1.
Results inserted in db are as below
a:6:{s:10:"0000000031";s:2:"25";s:10:"0000000032";s:0:"";s:10:"0000000033";s:2:"35";s:10:"0000000034";s:0:"";s:10:"0000000035";s:0:"";s:10:"0000000036";s:0:"";}
As you can see the array only has 2 values "25" and "35".
How can I prevent the other empty values to be recorded?