[英]How do I get the previous and next record when there is no auto incrementing ID column?
[英]How do I post a hidden incrementing id?
因此,我发布了各种东西后得到了一点(步骤)表格。 现在,每次我创建一个新的$step
,我也想存储一个递增的order_id
。 什么是正确的方法?
到目前为止,我的代码:
<input type="hidden" name="order" value="{{ isset($step) ? '' : $step->order }}">
PS:我知道isset
是没有意义的,但是我知道魔术发生在value
属性内。
if (array_key_exists('order', $_POST)) { $value = (empty($_POST['order'])) ? '' : $_POST['order']; }
添加在:
isset()
检查是否设置了$ _POST ['order'],$ _ POST ['order']可以为非null。
array_key_exists()
检查$ _POST中是否存在“ order”键。
empty()
用于检查$ _POST ['order']是否为空或为null。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.