douyao2529 2016-03-23 19:55
浏览 19

Substr&Strrchr的价值

I have the following form input :

<input value="<?php echo isset($item['product_id']) ? $item['product_id']: ''; ?>" type="text" data-type="productCode" name="data[InvoiceDetail][<?php echo $key;?>][product_id]" id="itemNo_<?php echo $key+1?>" class="form-control autocomplete_txt" autocomplete="off" onkeyup="return tabE(this,event);">

The input auto populates with the product code, and looks like this : Manufacturer:Submanufacturer:etc:etc:model

I used the following code :

<?php 
            $productid = isset($item['product_id']) ? $item['product_id'] : '';
            $fproductid = substr(strrchr($productid, ":"), 1);
        ?>

and converted the above code to such :

<input value="<?php echo $fproductid; ?>" type="text" data-type="productCode" name="data[InvoiceDetail][<?php echo $key;?>][product_id]" id="itemNo_<?php echo $key+1?>" class="form-control autocomplete_txt" autocomplete="off" onkeyup="return tabE(this,event);">

with the output being : model

However, when I save the form, and reload, the fields are blank? How can I save the form with the original data(with manufacturers), but only display the model in the user entered fields?

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥20 怎么用dlib库的算法识别小麦病虫害
    • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
    • ¥15 java写代码遇到问题,求帮助
    • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
    • ¥15 有了解d3和topogram.js库的吗?有偿请教
    • ¥100 任意维数的K均值聚类
    • ¥15 stamps做sbas-insar,时序沉降图怎么画
    • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
    • ¥15 关于#Java#的问题,如何解决?
    • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算