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

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 !

PHP中的新内容我的问题非常简单:) p>

问题的示例: p>

 &lt;?php 
if(isset($ _ GET ['edit'])){
 $ res_hed = $ mysqli-&gt; query(  “选择增值税来自客户WHERE id = $ _ GET [edit]”); 
 
for($ row_no = $ res_hed-&gt; num_rows  -  1; $ row_no&gt; = 0; $ row_no--){
 $ VAT  = $ row ['VAT']; 
} 
echo“
&lt; form class ='col-md-3'method ='GET'&gt; 
&lt; h3&gt;编辑增值税&lt; / h3&gt; 
&lt; div  class ='form-group'&gt; 
&lt; label&gt; VAT&lt; / label&gt; 
&lt; input class ='form-control'type ='text'name ='VAT'value = $ VAT&gt; 
&lt; / div&gt  ; 
?&gt; 
} 
  code>  pre> 
 
 

表中数据字段VAT ='GB1122 155 4555' 当在变量$ VAT i中设置值时 只获得'GB1122' p>

提前感谢您的帮助! p> div>

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>";