从数据库添加值到预填表单

时间:2018-05-20 21:53:06

标签: php mysql laravel

{{Form::label('listing', 'Price:')}}
{{Form::text('price','' , ['class' => 'form-control', 'placeholder' => 'Price'])}}

我想从数据库

预填充值{{listing->price}}的表单
{{Form::label('listing', 'Price:')}}
{{Form::text('price','{{listing->price}}' , ['class' => 'form-control', 'placeholder' => 'Price'])}}

ERROR: Parse error: syntax error, unexpected '}', expecting ',' or ')'

这是一个很好的解决方案吗?设置变量并在

中解析它
$f = ($listing->price);
echo('{{Form::text('price',.$f. , ['class' => 'form-control', 'placeholder' => 'Price'])}}')

1 个答案:

答案 0 :(得分:0)

逃避你的报价:

try {

                    DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
                    DocumentBuilder db = dbf.newDocumentBuilder();
                    Document dom = db.parse(new StringBufferInputStream(currentLine));
                    Element docEle = dom.getDocumentElement();
                    dom.getDocumentElement().normalize();

                    logger.info("Root element :" + dom.getDocumentElement().getNodeName());

                    /* Iterate over companies */
                    NodeList messageListNodes = docEle.getChildNodes();
                    if (messageListNodes != null) { 
                        int length = messageListNodes.getLength();                      
                        for (int i = 0; i < length; i++) {

                            if(messageListNodes.item(i) instanceof Element){
                                message.setId(UUID.fromString(messageListNodes.item(i).getTextContent()));
                                message.setCompany(messageListNodes.item(1).getTextContent());
                                message.setContent(messageListNodes.item(2).getTextContent());

                            }

                            logger.debug( name+ company + content);
                            messagelist.add(message);
                        }

                    }