I am trying to create a form to edit a record in the database
I did a query to get the information and it works fine to fill in the text boxes except when the word has spaces it’s only outputting the first word
if I echo the variable it prints the word with spaces. However once i try to make it the value of the text box it only appears as one word
Expected result:
inside the text box:
any text
Actual result:
inside the text box:
any
PHP Code:
[LEFT] [COLOR=#000000] [COLOR=#0000BB]$vendorID[/COLOR][COLOR=#007700]= [/COLOR][COLOR=#0000BB]$_GET[/COLOR][COLOR=#007700][[/COLOR][COLOR=#DD0000]'var1'[/COLOR][COLOR=#007700]];
[/COLOR][COLOR=#0000BB]$sql[/COLOR][COLOR=#007700]=[/COLOR][COLOR=#DD0000]“SELECT * FROM vendor
WHERE vendor_ref = ‘$vendorID’”[/COLOR][COLOR=#007700];
[/COLOR][COLOR=#0000BB]$qry [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#0000BB]mysql_query[/COLOR]COLOR=#007700;
if ([/COLOR][COLOR=#0000BB]mysql_num_rows[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000BB]$qry[/COLOR][COLOR=#007700]) > [/COLOR][COLOR=#0000BB]0[/COLOR][COLOR=#007700]) {
while ([/COLOR][COLOR=#0000BB]$rs [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#0000BB]mysql_fetch_assoc[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000BB]$qry[/COLOR][COLOR=#007700])) {
[/COLOR][COLOR=#0000BB]$name[/COLOR][COLOR=#007700]= [/COLOR][COLOR=#0000BB]$rs[/COLOR][COLOR=#007700][[/COLOR][COLOR=#DD0000]'name'[/COLOR][COLOR=#007700]];
echo [/COLOR][COLOR=#0000BB]$name[/COLOR][COLOR=#007700];
print[/COLOR][COLOR=#DD0000]’
<title>Edit Vendor</title>
<form method="POST" action="vendor_edit2.php">
<table>
<col span="1" align="right">
<tr>
<td><font color="blue">Company Name:</font></td>
<td><input type="text" name="name" value='[/COLOR][COLOR=#007700].[/COLOR][COLOR=#0000BB]$name[/COLOR][COLOR=#007700].[/COLOR][COLOR=#DD0000]'></td>
</tr>
}
} else {
echo ‘[/COLOR][COLOR=#0000BB]no result found[/COLOR][COLOR=#007700]’[/COLOR][COLOR=#0000BB];
}
[/COLOR] [/COLOR] [/LEFT]
So i don’t know if i’m writing the value part right… i’ve tried every possible way i could
THANKS
[URL=“http://forums.tizag.com/editpost.php?do=editpost&p=46451”]