How to get data from other php scripts

Posted by user225269 on Stack Overflow See other posts from Stack Overflow or by user225269
Published on 2010-04-21T02:21:00Z Indexed on 2010/04/21 2:23 UTC
Read the original article Hit count: 316

Filed under:
|

I have 2 files, one is used to view the data in the mysql database, and list it on a table:

if($_POST['general'] == 'ADDRESS'){
$result2 = mysql_query("SELECT * FROM student WHERE ADDRESS='$saddress'");


echo "<table border='1'>
<tr>
<th>IDNO</th>
<th>ADDRESS</th>
<th>LASTNAME</th>
<th>FIRSTNAME</th>
<th>VIEW</th>

</tr>";

while($row = mysql_fetch_array($result2))
  {
   echo "<tr>";
   echo "<td>" . $row['IDNO'] . "</td>";
echo "<td>" . $row['ADDRESS'] . "</td>";
  echo "<td>" . $row['LASTNAME'] . "</td>";
    echo "<td>" . $row['FIRSTNAME'] . "</td>";
    echo "<td><a href='update.php?id=" . $row['IDNO'] . "'>view</a></td>";

  echo "</tr>";
  }
echo "</table>";
}

And this one is the update.php which I am working on, I just want to be able to see the data that corresponds to the one the record that I clicked on the first one using the link "view".

<?php
mysql_select_db("school", $con);
 $result3 = mysql_query("SELECT * FROM student WHERE IDNO='?'");
?>



<tr>
<td width="30" height="35"><font size="3">*I D Number:</td>
<td width="30"><input  name="idnum" onkeypress="return isNumberKey(event)" type="text" maxlength="5" id='numbers'/ value="<?php echo $row["IDNO"]; ?>"></td>
</tr>

But I do not know how do I link the two, in such a way that the corresponding data in here:

echo "<td><a href='update.php?id=" . $row['IDNO'] . "'>view</a></td>";

would be reflected in here:

<td width="30"><input  name="idnum" onkeypress="return isNumberKey(event)" type="text" maxlength="5" id='numbers'/ value="<?php echo $row["IDNO"]; ?>"></td>
    </tr>

Please give me an idea on how I can do this, thanks.

© Stack Overflow or respective owner

Related posts about php

Related posts about mysql