Jump to content

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


ellchr3
Go to solution Solved by Jessica,

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);
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.