I want to pass a php variable, which is store in $row['ID'] to another page so i can execute my sql query with the passed variable.
I have this line of code with me
<?php echo ("<td>" . "<a href='http://localhost/kinhock/delete.php?ID=$row['ID']'>"
. "Delete" . "<td>"); ?>
However i am getting syntax error, unexpected '' (T_ENCAPSED_AND_WHITESPACE), expecting identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING)
I am not clear about the double quote and single quote position. Is there any other way to pass my php variable instead of using this?
就像
echo "<td><a href='http://localhost/kinhock/delete.php?ID=".$row['ID']."'>Delete<td>";
When you have an array variable with a quoted string, you have to put a block around it to get it to interpolate properly. Your entire string can be rendered like this, just using interpolation:
echo "<td><a href='http://localhost/kinhock/delete.php?ID={$row['ID']}'>Delete<td>";
Try this
<?php
echo "<td><a href='http://localhost/kinhock/delete.php?ID=".$row['ID']."'>Delete<td>";
?>
echo不使用(),就像这样
echo "<td>" . "<a href='http://localhost/kinhock/delete.php?ID=".$row['ID'].">" . "Delete" . "<td>");
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.