$mcg['klost'] && $mcg['slost']
, а он будет true или false. В итоге в рамках твоего примера это бессмысленно, если тебе нужно проверить две переменные, то используй if.$status = '';
$statusok = 'Выполнен';
$statusbad = 'Не выполнен';
$something = $mcg['klost'] && $mcg['slost']; // в $something будет true или false, третьего не дано
$somethingElse = $mcg['klost'] == 0 && $mcg['slost'] == 0; // здесь то же самое, true или false
switch ($something):
case ($somethingElse):
$status = $statusok;
break;
default:
$status = $statusbad;
break;
endswitch;
$smarty->assign('status', $status);
<form method="POST" action="/" id="form">
<label><input type="checkbox" name="svois[]" class="svois" value="7"> Высота</label><br/>
<label><input type="checkbox" name="svois[]" class="svois" value="8"> Количество</label><br/>
<label><input type="checkbox" name="svois[]" class="svois" value="9"> Назначение</label><br/>
<label><input type="checkbox" name="svois[]" class="svois" value="10"> Способ изготовления, метод производства</label><br/>
<label><input type="checkbox" name="svois[]" class="svois" value="11"> Диаметр</label><br/>
<label><input type="checkbox" name="svois[]" class="svois" value="12"> Вид обработки</label><br/>
<label><input type="checkbox" name="svois[]" class="svois" value="13"> Тип покрытия</label><br/>
<label><input type="checkbox" name="svois[]" class="svois" value="14"> Форма</label><br/>
<input type="submit" value="Отправить">
</form>
<script>
$(function(){
var form = $('#form');
form.on('submit', function(e){
e.preventDefault();
$.ajax({
type: form.attr('method'),
url: form.attr('action'),
data: form.serialize(),
success: function(result)
{
console.log( result );
}
});
});
});
</script>
$(document).ready(function () {
var table = $('table');
var cells = table.find('td');
var firstCorner, secondCorner, val;
function getCellIndex(cell) {
return {
x: $(cell).index(),
y: $(cell).parent().index()
};
}
function getRangeFromCorners(firstCorner, secondCorner, axis) {
var from, to;
if (firstCorner[axis] < secondCorner[axis]) {
from = firstCorner[axis];
to = secondCorner[axis];
}
else {
from = secondCorner[axis];
to = firstCorner[axis];
}
to = ':lt(' + ( to - from + 1 ) + ')';
from = from > 0
? ':gt(' + ( from - 1 ) + ')'
: '';
return from + to;
}
function onSelectEnd() {
cells.off('mouseover.selectRange');
table.find('.selected')
.removeClass('selected')
.html(val);
}
cells.on('mousedown', function () {
firstCorner = getCellIndex(this);
secondCorner = getCellIndex(this);
val = $(this).text();
cells.each(function () {
$(this).data('oldval', $(this).html());
});
cells.on('mouseover.selectRange', function () {
secondCorner = getCellIndex(this);
var rangeX = getRangeFromCorners(firstCorner, secondCorner, 'x');
var rangeY = getRangeFromCorners(firstCorner, secondCorner, 'y');
cells.filter('.selected').each(function () {
$(this).removeClass('selected')
.html($(this).data('oldval'));
});
table.find('tr' + rangeY).each(function () {
$(this).find('td' + rangeX)
.addClass('selected')
.html(val);
});
});
$('body')
.on('mouseup.removeCellListener', function () {
$(this).off('mouseup.removeCellListener');
onSelectEnd();
})
.on('mouseleave.removeCellListener', function () {
$(this).off('mouseleave.removeCellListener');
onSelectEnd();
});
});
});
<link rel="stylesheet" href="http://harvesthq.github.io/chosen/chosen.css">
<script src="http://code.jquery.com/jquery-1.12.1.min.js" type="text/javascript"></script>
<script src="http://harvesthq.github.io/chosen/chosen.jquery.js" type="text/javascript"></script>
<select name="brend" class="brendid" data-placeholder="Выберите бренд" id="brendid" style="width:250px;">
<option value="1">Первый</option>
<option value="2">Второй</option>
<option value="3">Третий</option>
</select>
<script type="text/javascript">
$(function () {
var select = $('#brendid');
select.chosen();
select.find('option').removeAttr('selected')
.last().attr('selected', 'selected');
select.trigger('chosen:updated');
select.on('change', function () {
alert($(this).val());
});
});
</script>
$(this).toggleClass('active');
// ...
if ($(this).hasClass('active'))
$(this).removeClass('active');
else
$(this).addClass('active');
// ...
element.classList.toggle('active');
// ...
if (element.classList.contains('active'))
element.classList.remove('active');
else
element.classList.add('active');
$(document).ready(function () {
var loginBtn = $('#login-trigger');
var signupBtn = $('#signup-trigger');
loginBtn.click(function () {
if (signupBtn.hasClass('active')) signupBtn.trigger('click');
$(this).next('#login-content').slideToggle();
$(this).toggleClass('active');
if ($(this).hasClass('active')) $(this).find('span').html('▲')
else $(this).find('span').html('▼');
});
signupBtn.click(function () {
if (loginBtn.hasClass('active')) loginBtn.trigger('click');
$(this).next('#signup-content').slideToggle();
$(this).toggleClass('active');
if ($(this).hasClass('active')) $(this).find('span').html('▲')
else $(this).find('span').html('▼');
})
});
$host = 'www.example.com';
$data = urlencode('param1=a¶m2=b¶m3=25');
$headers = array();
$headers[] = 'POST /path/to/page HTTP/1.1';
$headers[] = 'Host: ' . $host;
$headers[] = 'User-Agent: PHP/' . phpversion();
$headers[] = 'Content-Type: text/html; charset=utf-8';
$headers[] = 'Content-length: ' . strlen($data);
$headers[] = 'Connection: close';
$headers[] = '';
$headers[] = '';
$content = implode("\r\n", $headers) . $data;
$result = '';
$sock = fsockopen($host, 80);
fputs($sock, $content);
while (!feof($sock))
$result .= fread($sock, 32000);
fclose($sock);
echo $result;
var a_pattern = /^[а-яa-z ]+$/i;
var b_pattern = /^.+@.+\..+$/i;
var c_pattern = /^[0-9a-z]+$/i;
// ...
var a = obj.name.value;
var b = obj.email.value;
var c = obj.pass.value;
console.log(a);
console.log(b);
console.log(c);
// ...
<script src="http://code.jquery.com/jquery-1.11.3.min.js"></script>
<img src="#" id="img_load">
<a href="#" name="button1" data-num="1" class="button">кнопка</a>
<a href="#" name="button2" data-num="2" class="button">кнопка</a>
<a href="#" name="button3" data-num="3" class="button">кнопка</a>
<a href="#" name="button4" data-num="4" class="button">кнопка</a>
<div class="results"></div>
<script language="javascript" type="text/javascript">
$('.button').on('click', function(e){
e.preventDefault();
var img = $('#img_load');
var current = $(this);
var buttons = $('.button');
$.ajax({
type: 'POST',
url: 'setings.php',
data: 'btn=' + current.data('num'),
success: function(data){
$('.results').html(data);
buttons.each(function(){
$(this).html( 'Кнопка ' + $(this).data('num') );
});
current.html( 'Кликнули сюда' );
img.attr('src', 'image url');
}
});
});
</script>