Hallo zusammen,
ich komme einfach nicht weiter.
Hier mal der php Code:
In den Code geht folgendes nicht.PHP-Code:function save() {
// Check for request forgeries
JRequest::checkToken() or jexit( 'Invalid Token' );
//get data from request
$post = JRequest::get('post');
$post['name'] = JRequest::getVar('name', '', 'post', 'name', JREQUEST_ALLOWRAW);
$post['version'] = JRequest::getVar('version', '', 'post', 'version', JREQUEST_ALLOWRAW);
$post['unpack'] = JRequest::getVar('unpack', '', 'post', 'unpack', JREQUEST_ALLOWRAW);
$post['switchs'] = JRequest::getVar('switchs', '', 'post', 'switchs', JREQUEST_ALLOWRAW);
$post['infos'] = JRequest::getVar('infos', '', 'post', 'infos', JREQUEST_ALLOWRAW);
// Dieser Bereich geht nicht Anfang
$str = $post['name'];
$short = substr($str, 0, 1);
$outlay = ucfirst($short);
if (preg_match('/([A-Z]+)/', $outlay)) {
$cat = $outlay;
}else{
$cat = '1';
}
if ($cat == 'A' || $cat == 'B' || $cat == 'C') { $catid = '1';}
elseif ($cat == 'D' || $cat == 'E' || $cat == 'F') { $catid = '2';}
elseif ($cat == 'G' || $cat == 'H' || $cat == 'I') { $catid = '3';}
elseif ($cat == 'J' || $cat == 'K' || $cat == 'L') { $catid = '4';}
elseif ($cat == 'M' || $cat == 'N' || $cat == 'O') { $catid = '5';}
elseif ($cat == 'P' || $cat == 'Q' || $cat == 'R') { $catid = '6';}
elseif ($cat == 'S' || $cat == 'T' || $cat == 'U') { $catid = '7';}
elseif ($cat == 'V' || $cat == 'W' || $cat == 'X') { $catid = '8';}
elseif ($cat == 'Y' || $cat == 'Z') { $catid = '9';}
elseif ($cat == '1') { $catid = '10';}
$catid = JRequest::getVar('catid', '', 'post', 'catid', JREQUEST_ALLOWRAW);
// Dieser Bereich geht nicht Ende
// get the redirect
$return = JURI::base();
// get the model
$model = $this->getModel('switchdatabase');
if ($model->store($post)) {
$msg = JText::_('MSG_TEXT_SAVE');
echo '<meta **********=********* content="3;URL=javascript: history.go(-2)" />', $msg;
} else {
$msg = JText::_('MSG_TEXT_SAVE_ERROR');
echo '<meta **********=********* content="3;URL=javascript: history.go(-1)" />', $msg;
}
}
Könnte mir da einer helfen, wo ich da einen Fehler haben, dass er mir nicht die $catid einträgt?PHP-Code:$str = $post['name'];
$short = substr($str, 0, 1);
$outlay = ucfirst($short);
if (preg_match('/([A-Z]+)/', $outlay)) {
$cat = $outlay;
}else{
$cat = '1';
}
if ($cat == 'A' || $cat == 'B' || $cat == 'C') { $catid = '1';}
elseif ($cat == 'D' || $cat == 'E' || $cat == 'F') { $catid = '2';}
elseif ($cat == 'G' || $cat == 'H' || $cat == 'I') { $catid = '3';}
elseif ($cat == 'J' || $cat == 'K' || $cat == 'L') { $catid = '4';}
elseif ($cat == 'M' || $cat == 'N' || $cat == 'O') { $catid = '5';}
elseif ($cat == 'P' || $cat == 'Q' || $cat == 'R') { $catid = '6';}
elseif ($cat == 'S' || $cat == 'T' || $cat == 'U') { $catid = '7';}
elseif ($cat == 'V' || $cat == 'W' || $cat == 'X') { $catid = '8';}
elseif ($cat == 'Y' || $cat == 'Z') { $catid = '9';}
elseif ($cat == '1') { $catid = '10';}
$catid = JRequest::getVar('catid', '', 'post', 'catid', JREQUEST_ALLOWRAW);
Grüße
Olaf


LinkBack URL
About LinkBacks

Zitieren

Lesezeichen