Reputation: 195
I have an edit form that retrieve person's information from database and fill them to textbox in a form to let the user to edit his info. , the problem is: when the field is a sentence (i.e. Full name) it prints only the first word(which is the first name). my code is:
<label class ="label">Enter your full name</label>
<input type="text" name="Name" class="textbox" value= <?php echo $row["Name"]?> required/>
even though when I tried to echo $row["Name"]
, it prints it fully.
thanks in advance,
Upvotes: 1
Views: 28
Reputation: 1646
Use value in double-quote $row['Name']
in single-quote
<label class ="label">Enter your full name</label>
<input type="text" name="Name" class="textbox" value="<?php echo $row['Name']?"> required/>
Upvotes: 1
Reputation: 4033
You can use as follows: suppose you have users table to store the user information then.
$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/>
where the name is the column name from database table
Upvotes: 1
Reputation: 131
I believe you're missing quotes around the value attribute, try:
<label class ="label">Enter your full name</label>
<input type="text" name="Name" class="textbox" value="<?php echo $row["Name"]?>" required/>
Upvotes: 2