首页 > 解决方案 > PHP - 不识别和显示输入

问题描述

PHP noob 在这里,我被困在我的个人项目中。我想显示一个项目的第二个价格(租赁网站),但我没有显示第二个价格。我将粘贴代码和快照。结果

所以基本上,我希望用户为一个项目输入两个费率并在项目详细信息页面上显示两者。所以问题是二等奖没有注册。

代码分为create.blade.php(用户进行输入的地方)和details.blade.php(负责生成的图片)。

<!-- CREATE.BLADE.PHP CODE HERE -->
<!-- customFields -->
            <div id="customFields"></div>

                <!-- price -->
        <?php $priceError = (isset($errors) and $errors->has('price')) ? ' is-invalid' : ''; ?>
              <div id="priceBloc" class="form-group row">
                <label class="col-md-3 col-form-label" for="price">{{ t('Price') }}</label>
                    <div class="input-group col-md-8">
                        <div class="input-group-prepend">
                        <span class="input-group-text">{!! config('currency')['symbol'] !!}</span>
                    </div>

                        <input id="price"
                               name="price"
                               class="form-control{{ $priceError }}"
                               placeholder="{{ t('e.i. 15000') }}"
                               type="text" value="{{ old('price') }}"
                        >


    <div class="input-group-append">
                            <span class="input-group-text">
                              <input id="negotiable" name="negotiable" type="checkbox"
                                    value="1" {{ (old('negotiable')=='1') ? 'checked="checked"' : '' }}>&nbsp;<small>{{ t('Negotiable') }}</small>
                            </span>
                                </div>
                            </div>
                                        </div>
                                        <!-- Price 2-->
                                        <?php $priceError = (isset($errors) and $errors->has('price2')) ? ' is-invalid' : ''; ?>
                                        <div id="priceBloc" class="form-group row">
                                            <label class="col-md-3 col-form-label" for="price2">Rate per Week</label>
                                            <div class="input-group col-md-8">
                                                <div class="input-group-prepend">
                                                    <span class="input-group-text">{!! config('currency')['symbol'] !!}</span>
                                            </div>

                                                <input id="price2"
                                                       name="price2"
                                                       class="form-control{{ $priceError }}"
                                                       placeholder="{{ t('e.i. 15000') }}"
                                                       type="text" value="{{ old('price2') }}"
                                                >

                                                <div class="input-group-append">
                                                    <span class="input-group-text">
                                                        <input id="negotiable" name="negotiable" type="checkbox"
                                                               value="1" {{ (old('negotiable')=='1') ? 'checked="checked"' : '' }}>&nbsp;<small>{{ t('Negotiable') }}</small>
                                                    </span>
                                                </div>
                                            </div>
                                        </div>
<!-- END -->

内容details.blade.php

<!--DETAILS.BLADE.PHP CODE HERE -->

    @if (!in_array($post->category->type, ['not-salable']))
                            <!-- Price / Salary -->
                <div class="detail-line-lite col-md-6 col-sm-6 col-xs-6">
                    <div>
                        <span>
                    {{ (!in_array($post->category->type, ['job-offer', 'job-search'])) ? t('Price') : t('Salary') }}:
                        </span>
                        <span>
                            @if ($post->price > 0)
                                {!! \App\Helpers\Number::money($post->price) !!}
                              @else
                                {!! \App\Helpers\Number::money(' --') !!}
                            @endif
                            @if ($post->negotiable == 1)
                                <small class="label badge-success"> {{ t('Negotiable') }}</small>
                            @endif
                        </span>
                    </div>
                </div>

                    <!-- Price 2 / Salary -->
                <div class="detail-line-lite col-md-6 col-sm-6 col-xs-6">
                    <div>
                        <span>
{{ (!in_array($post->category->type, ['job-offer', 'job-search'])) ? t('Price per week') : t('Salary') }}:


    </span>
                        <span>
                            @if ($post->price2 > 0)
                              {!! \App\Helpers\Number::money($post->price2) !!}
                            @else
                              {!! \App\Helpers\Number::money(' --') !!}
                            @endif
                            @if ($post->negotiable == 1)
                                <small class="label badge-success"> {{ t('Negotiable') }}</small>
                            @endif
                        </span>
                    </div>
                </div>
   <!-- END-->

谢谢你的帮助 :)

标签: phphtmllaravel-blade

解决方案


推荐阅读