Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/67.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
从mysql中提取值并在php表单中编辑_Php_Mysql - Fatal编程技术网

从mysql中提取值并在php表单中编辑

从mysql中提取值并在php表单中编辑,php,mysql,Php,Mysql,我有一个编辑表单,可以从数据库中检索个人信息,并将其填写到表单的文本框中,以便用户编辑其信息,问题是:当字段是一个句子,即全名时,它只打印第一个单词,即第一个名称。我的代码是: <label class ="label">Enter your full name</label> <input type="text" name="Name" class="textbox" value= <?php echo $row["Name"]?&

我有一个编辑表单,可以从数据库中检索个人信息,并将其填写到表单的文本框中,以便用户编辑其信息,问题是:当字段是一个句子,即全名时,它只打印第一个单词,即第一个名称。我的代码是:

  <label class ="label">Enter your full name</label>
          <input type="text" name="Name"  class="textbox" value= <?php echo $row["Name"]?> required/>
即使当我尝试回显$row[Name]时,它也会完全打印它


提前感谢,

我认为您缺少有关value属性的引号,请尝试:

 <label class ="label">Enter your full name</label>
      <input type="text" name="Name"  class="textbox" value="<?php echo $row["Name"]?>" required/>

我相信您缺少value属性的引号,请尝试:

 <label class ="label">Enter your full name</label>
      <input type="text" name="Name"  class="textbox" value="<?php echo $row["Name"]?>" required/>

您可以按如下方式使用:假设您有users表来存储用户信息

$query = mysql_query('select *from users where id=2'); //you can use dynamic 
$rec=mysql_fetch_array($query);
 <label class ="label">Enter your full name</label>
          <input type="text" name="Name"  class="textbox" value= <?php echo $rec["name"];?> required/>

其中名称是数据库表中的列名,您可以按如下方式使用:假设您有users表来存储用户信息

$query = mysql_query('select *from users where id=2'); //you can use dynamic 
$rec=mysql_fetch_array($query);
 <label class ="label">Enter your full name</label>
          <input type="text" name="Name"  class="textbox" value= <?php echo $rec["name"];?> required/>
其中名称是数据库表中的列名

使用双引号$row['name']中的值作为单引号

<label class ="label">Enter your full name</label>
      <input type="text" name="Name"  class="textbox" value="<?php echo $row['Name']?"> required/>
在单引号中使用双引号$row['Name']中的值

<label class ="label">Enter your full name</label>
      <input type="text" name="Name"  class="textbox" value="<?php echo $row['Name']?"> required/>

您需要列出数据库中所有与名称相关的字段。它像名字吗?或者像first_name、last_name?您需要列出数据库中所有与姓名相关的字段。它像名字吗?或者像名字,姓?