duanchun1909 2018-09-01 08:50
浏览 32
已采纳

PHP - Mysql在一个变量中放一个$ row [],在第一个空格后剪切文本

new in PHP my question can be very easy for you :)

example of the issue:

<?php 
if(isset($_GET['edit'])) { 
$res_hed = $mysqli->query("select VAT FROM CUSTOMERS WHERE id=$_GET[edit]");

for ($row_no = $res_hed->num_rows - 1; $row_no >= 0; $row_no--) {
$VAT = $row['VAT'];
                    }
echo "
<form class='col-md-3' method='GET'>
<h3>Edit VAT</h3>
<div class='form-group'>
<label>VAT</label>
<input class='form-control' type='text' name='VAT' value=$VAT>
</div>
?>      
}

Data in table for field VAT = 'GB1122 155 4555' When the value is set in the variable $VAT i get only 'GB1122'

Thanks in advance for your help !

  • 写回答

1条回答 默认 最新

  • dongtao1262 2018-09-01 08:56
    关注

    Your value attribute should be in quotes

    <input class='form-control' type='text' name='VAT' value='$VAT'>
    

    You may also be missing the end " off the text...

    </div>";
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 随身WiFi网络灯亮但是没有网络,如何解决?
  • ¥15 gdf格式的脑电数据如何处理matlab
  • ¥20 重新写的代码替换了之后运行hbuliderx就这样了
  • ¥100 监控抖音用户作品更新可以微信公众号提醒
  • ¥15 UE5 如何可以不渲染HDRIBackdrop背景
  • ¥70 2048小游戏毕设项目
  • ¥20 mysql架构,按照姓名分表
  • ¥15 MATLAB实现区间[a,b]上的Gauss-Legendre积分
  • ¥15 delphi webbrowser组件网页下拉菜单自动选择问题
  • ¥15 linux驱动,linux应用,多线程