输入名称为“ option [] [width]”,因为我要2个输入乘法,但不会崩溃。请输入这样的名称。
<?php
$height = null;
$width = null;
function vir2nok($data) {
return str_replace(",",".",$data);
}
if ($_POST) {
$height = vir2nok($_POST["height"]);
$width = vir2nok($_POST["width"]);
if (is_numeric($height) && is_numeric($width)) {
$sonuc = $height * $width;
echo $height." x ".$width." = ".$sonuc."<hr>";
}
}
?>
<form action="" method="post">
<input type="text" name="option[<?php echo $option['product_option_id']; ?>][height]" placeholder="<?php echo $label_height; ?>" id="input-option<?php echo $option['product_option_id']; ?>" class="pso-height-input form-control" />
<input type="text" name="option[<?php echo $option['product_option_id']; ?>][width]" placeholder="<?php echo $label_width; ?>" id="input-option<?php echo $option['product_option_id']; ?>" class="pso-width-input form-control" />
<input type="submit" name="gonder">
</form>
答案 0 :(得分:0)
您没有正确访问字段,请尝试将这两行更改为:
router.get('/', (req, res) => {
Intro.find({}, (err, items) => {
if (err) {
res.send("Something went wrong: " + err);
} else {
res.render('index', {
title: items[0].title
})
}
});
});