Hi: echo '<form method="post" action="edit.php">'; echo '<table>'; echo '<tr><td>Ename<input type="text" name="Ename" value="<? echo $row['Ename']; ?>" ></td>'; echo '</tr>'; echo '</table></form>'; It show the error messge on --value="<? echo $row['Ename']; ?>"-- (Parse error: parse error, unexpected T_STRING, expecting ',' or ';' in C:\wamp\www\delete.php on line 40) can anyone help me ?
I'd suggest replacing: echo '<tr><td>Ename<input type="text" name="Ename" value="<? echo $row['Ename']; ?>" ></td>'; with: echo '<tr><td>Ename<input type="text" name="Ename" value="' . $row['Ename']; . '" ></td>'; You're basically in the PHP parser, then trying to break in to the parser again (which does nothing) but then you break out straight after your echo, stopping the one and only parser, while you still have more to go. Hence, you never close the string you are echo'ing as far as PHP is concerned and so you get that error...
Not true at all. PHP is parsing the whole thing as one line until it finds a ; The issue is that he used single quotes to start and end the echo. He also usd single quotes in the $row variable. THAT closed the echo early. You need to escape single quotes used in a single quote encapsulated echo, and likewise for double quotes.
Another way to do it (maybe more simple). echo '<form method="post" action="edit.php">'; echo '<table>'; echo '<tr><td>Ename<input type="text" name="Ename" value=\"$row[Ename]\" ></td>'; echo '</tr>'; echo '</table></form>'; PHP:
goldensea80: that won't work, either, unfortunately. Your variable is in a string that uses single quotes (I don't quite know why you're trying to escape the double quotes around the $row[Ename]). Because of those single quotes, the variable won't be interpreted at all. mykoleary: you're right about those quotes. I think I need to upgrade my brain's PHP parser
Sorry, I made mistakes THis should work! echo '<form method="post" action="edit.php">'; echo '<table>'; echo "<tr><td>Ename<input type=\"text\" name=\"Ename\" value=\"$row[Ename]\" ></td>"; echo '</tr>'; echo '</table></form>'; PHP: