tags:

views:

34

answers:

2

Hi, im trying to pass the information of a specific data to be edited in another form which is edit_doc.php. However, when i click "Edit" it doesnt seem to work. Only edit_doc.php opens but the information the does not appear. Is ther any mistake in the codes? Please help.

[php]

  echo "<table border='1'>
    <th>File Reference No.</th>
    <th>File Name</th>
    <th>Owner</th>
    <th>iShare URL</th>
    <th>Edit</th>
    <th>Borrow</th>
    <th>Delete</th>
    </tr>";
    while ($rows = mysql_fetch_assoc($run))  
    {
      echo "<tr>";
      echo "<td>". $rows['file_ref']  ."</td>";
      echo "<td>". $rows['file_name'] ."</td>";
      echo "<td>". $rows['owner'] ."</td>";
      echo "<td>". $rows['url']    ."</td>";
      echo "<td><a href=edit_doc.php?id=<?php $['id']; ?>" . "Edit" . "</a></td>";

      echo "</tr>";

    }
   echo "</table>"; 

[/php]

Thank you.

+1  A: 

The code in the link is wrong, you are putting a <?php in a string, which will not be parsed by php. furthermore, the line must look something like this:

echo "<td><a href=edit_doc.php?id=" . $rows['id'] . ">Edit</a></td>";

consider using an editor with syntax highlighting.

Salandur
It works! Thank u! ;)
yash
do you understand the difference between your line and my line?
Salandur
+1  A: 

You have two problems:

  • You are using php tags inside php tags:
  • Missing $rows variable to get the db row value for id field

Here is the fixed version:

echo "<td><a href=edit_doc.php?id=" . $rows['id'] . ">Edit</a></td>";
Sarfraz
But d word "Edit" is not showing in my table now..
yash
Its solved. Thank u.
yash