Jump to content

Display results in a text box to be edited for update query


ellchr3

Recommended Posts

Hello, I'm trying to display the results of my query in a text box so that they can be edited, if need be, and updated in the database.  I'm getting the error below, with the code below.  I've tried a couple of different ways to format the "value" of the text box as you can see by the second one that's commented out and still a no go.  Thanks for any help in advance guys.


 


The error below is referring to the code just below here.


echo "<td><input type="text" name="firstname" value="$firstname"></td>";


 


Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in C:\


 



$rs=odbc_exec($conn,$sql);
if (!$rs)
{exit("Error in SQL");}
echo "<table><tr>";
echo "<th>First Name</th>";
echo "<th>Middle Initial</th>";
echo "<th>Last Name</th>";
echo "<th>Full Name</th>";
echo "<th>Provider ID</th></tr>";
while (odbc_fetch_row($rs))
{
$firstname=odbc_result($rs,"provider_first_name");
$middleinitial=odbc_result($rs,"provider_middle_name");
$lastname=odbc_result($rs,"provider_last_name");
$fullname=odbc_result($rs,"provider_full_name");
$provider_id=odbc_result($rs,"provider_id");



echo "<tr><td>$firstname</td>";
echo "<td><input type="text" name="firstname" value="$firstname"></td>";
echo "<td>$middleinitial</td>";
echo "<td>$lastname</td>";
echo "<td>$fullname</td>";
echo "<td>$provider_id</td>";
// echo "<td><input type="text" name="textfield" value='".$providerid."'"></td>";
echo "<td>$providerid</td></tr>";
}
odbc_close($conn);

Jessica,

 

Thanks for your reply.  I'm assuming this is to be done to the "value=..." portion of the statement?  I've tried lots of different combinations using the slash for escaping the string and even tried the addslashes function that I found in searching and couldn't get it to work.  I'm still fairly new to PHP so I do apologize for my ignorance at this point :(

 

 

You need to escape the double quotes within the string. Read the manual section on string.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.