Kay1021
May 20th, 2008, 10:46 PM
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:
$vendorID= $_GET['var1'];
$sql="SELECT * FROM vendor
WHERE vendor_ref = '$vendorID'";
$qry = mysql_query($sql);
if (mysql_num_rows($qry) > 0) {
while ($rs = mysql_fetch_assoc($qry)) {
$name= $rs['name'];
echo $name;
print'
<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='.$name.'></td>
</tr>
}
} else {
echo 'no result found';
}
So i don't know if i'm writing the value part right... i've tried every possible way i could
THANKS
http://forums.tizag.com/images/misc/progress.gif
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:
$vendorID= $_GET['var1'];
$sql="SELECT * FROM vendor
WHERE vendor_ref = '$vendorID'";
$qry = mysql_query($sql);
if (mysql_num_rows($qry) > 0) {
while ($rs = mysql_fetch_assoc($qry)) {
$name= $rs['name'];
echo $name;
print'
<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='.$name.'></td>
</tr>
}
} else {
echo 'no result found';
}
So i don't know if i'm writing the value part right... i've tried every possible way i could
THANKS
http://forums.tizag.com/images/misc/progress.gif