While displaying the data from the database on a text box, I can access only the first part of the name. For example, if the name is 'Five Star', only the name 'Five' is displayed. Can you help in this? I'm just a beginner.
This is the code i've used echo "<tr><td>Reg.No.:</td><td width='200'><input type='text' name='reg' value=".$row[RegNo]."></td></tr>";
Persi 0 Newbie Poster
Recommended Answers
Jump to PostHello,
please check below code:<?php
$reg=$row[RegNo];echo "<tr><td>Reg.No.:</td><td width='200'><input type='text' name='reg' value='$reg'></td></tr>";
?>
Jump to PostIf the value attribute is used without quotes, then the space (after Five in your case) will be assumed as the separator for the next attribute.
<!-- this was your output --> <input type='text' name='reg' value=Five Stars /> <!-- this is what it should be (as amitengg …
Jump to PostYou haven't added the quotes yet:
<input type="text" name="name" value="<?php echo $name; ?>"><br/>
Jump to PostShow your new code then.
Jump to PostAre you using php to output the whole html?
either
<input type="text" name="name" value="<?php echo $row['name']; ?>"><br/>
OR
echo "<input type=\"text\" name=\"name\" value=\"{$row['name']}\"><br/>";
All 19 Replies
Aser Gado 0 Junior Poster in Training

diafol
vaultdweller123 32 Posting Pro
amitengg 0 Newbie Poster
kimhanu -3 Newbie Poster
pritaeas commented: Do not hijack a thread, start your own. -3
pritaeas 2,211 ¯\_(ツ)_/¯ Moderator Featured Poster
diafol commented: Ah! Now I get it. Yes, agree. +15
Persi 0 Newbie Poster
Persi 0 Newbie Poster

diafol
pritaeas 2,211 ¯\_(ツ)_/¯ Moderator Featured Poster
Persi 0 Newbie Poster
pritaeas 2,211 ¯\_(ツ)_/¯ Moderator Featured Poster
Persi 0 Newbie Poster
Sorcher 6 Junior Poster

diafol
karthik_ppts 81 Posting Pro
Persi 0 Newbie Poster
pritaeas 2,211 ¯\_(ツ)_/¯ Moderator Featured Poster
Persi 0 Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.