if(isset($_POST['q_name']))
{
$qd = array();
/* Array ([q_act_atr_1] => 0 [q_act_val_1] => [q_tr_atr_1] => 0 [q_tr_val_1] => [q_ng_atr_1] => 0 [q_ng_val_1] => [q_nk_atr_NaN] => 0
[q_nk_val_NaN] => [q_info] => test описание [q_line1] => 1 [q_line2] => 1 [q_fast] => 1 [q_fast_city] => capitalcity [q_align1] => 1 [q_align2] => 1 [q_align3] => 1 ) */
$qd['name'] = $_POST['q_name'];
$qd['lvl'] = explode('-',$_POST['q_lvl']);
$qd['info'] = $_POST['q_info'];
if($_POST['q_line1']==1)
{
$qd['line'] = $_POST['q_line2'];
}
if($_POST['q_fast']==1)
{
$qd['city'] = $_POST['q_fast_city'];
$gd['fast'] = 1;
}
if($_POST['align1']==1)
{
$qd['align'] = 1;
}elseif($_POST['align2']==1)
{
$qd['align'] = 3;
}elseif($_POST['align3']==1)
{
$qd['align'] = 7;
}elseif($_POST['align4']==1)
{
$qd['align'] = 2;
}
$i = 1;
while($i!=-1)
{
if(isset($_POST['q_act_atr_'.$i]))
{
if($_POST['q_act_val_'.$i]!='')
{
$qd['act_date'] .= $_POST['q_act_atr_'.$i].':=:'.$_POST['q_act_val_'.$i].':|:';
}
}else{
$i = -2;
$qd['act_date'] = trim($qd['act_date'],':|:');
}
$i++;
}
$i = 1;
while($i!=-1)
{
if(isset($_POST['q_tr_atr_'.$i]))
{
if($_POST['q_tr_val_'.$i]!='')
{
$qd['tr_date'] .= $_POST['q_tr_atr_'.$i].':=:'.$_POST['q_tr_val_'.$i].':|:';
}
}else{
$i = -2;
$qd['tr_date'] = trim($qd['tr_date'],':|:');
}
$i++;
}
$i = 1;
while($i!=-1)
{
if(isset($_POST['q_ng_atr_'.$i]))
{
if($_POST['q_ng_val_'.$i]!='')
{
$qd['win_date'] .= $_POST['q_ng_atr_'.$i].':=:'.$_POST['q_ng_val_'.$i].':|:';
}
}else{
$i = -2;
$qd['win_date'] = trim($qd['win_date'],':|:');
}
$i++;
}
$i = 1;
while($i!=-1)
{
if(isset($_POST['q_nk_atr_'.$i]))
{
if($_POST['q_nk_val_'.$i]!='')
{
$qd['lose_date'] .= $_POST['q_nk_atr_'.$i].':=:'.$_POST['q_nk_val_'.$i].':|:';
}
}else{
$i = -2;
$qd['lose_date'] = trim($qd['lose_date'],':|:');
}
$i++;
}
mysql_query('INSERT INTO `quests` (`name`,`min_lvl`,`max_lvl`,`tr_date`,`act_date`,`win_date`,`lose_date`,`info`,`line`,`align`,`city`,`fast`) VALUES (
"'.mysql_real_escape_string($qd['name']).'","'.mysql_real_escape_string($qd['lvl'][0]).'","'.mysql_real_escape_string($qd['lvl'][1]).'",
"'.mysql_real_escape_string($qd['tr_date']).'","'.mysql_real_escape_string($qd['act_date']).'","'.mysql_real_escape_string($qd['win_date']).'",
"'.mysql_real_escape_string($qd['lose_date']).'","'.mysql_real_escape_string($qd['info']).'","'.mysql_real_escape_string($qd['line']).'",
"'.mysql_real_escape_string($qd['align']).'","'.mysql_real_escape_string($qd['city']).'","'.mysql_real_escape_string($qd['fast']).'")');
}
?>
Текстовое поле