从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?您需要列出数据库中所有与姓名相关的字段。它像名字吗?或者像名字,姓?