How pass row id from db to a form inside a div

I have a table full of data and each row is a link that shows a hidden div (made to look like a popup) that has a form to edit the “remarks” category.
Normally I would pass the ID through to the next page that has the form in it to display the current remarks (from the database based upon the ID) in a text box for edit. Once the form is submitted it updates the database based upon the ID and redirects you back to the main page.
My problem comes in when I’m only using


to show the div and don’t know of a way to pass the id of the row that has been clicked on to this form. Does anyone know how to do that (or maybe I’m making no sense).

Some code that I’m using:

This pulls the data from the database to show my rows in my tables

$DispQuery = "SELECT * FROM $MaxxForceInventoryTable " . $FilterVariable . "ORDER BY COLOR, $orderby $ascdesc";
$DispResult = mysql_query($DispQuery) or die(mysql_error().'<br />');
while ($Row = mysql_fetch_assoc($DispResult))

Here’s the code that gives me my mouse over clickable rows

ECHO "<TR BGCOLOR='" . $RowCOLOR . "' style='border-bottom-style: solid;' style='border-left-style: solid;' style='border-right-style: solid;' style=\\"Cursor:Hand\\" onClick=\\"showDiv()\\" onMouseOver=\\"'#E4E7FF';\\" onMouseOut=\\"'" . $RowCOLOR . "';\\">

Here’s showdiv()

function showDiv() {
if (document.getElementById) { // DOM3 = IE5, NS6
document.getElementById('hideshow').style.visibility = 'visible';
else {
if (document.layers) { // Netscape 4
document.hideshow.visibility = 'visible';
else { // IE 4 = 'visible';

Let me know if more info is needed. I cannot show the actual page as it is on an intranet site… Thanks in advance!

It looks like you are mixing javascript with your php with your onClick=“showDiv()”

Can you use a query string with javascript? I don’t know…

My instincts would be to use a query string to pass the ID

Maybe someone else knows…

you need to pass some extra variable in that showdiv function and generate dynamic divs
i would suggest rather go with ajax here
google for ajax solutions to display and hide exta info

(if you cannot do that or find one ,then i will look into it…)

Netscape 4 and IE4? Man you’re taking Backward compatibility waaaay to serious.

Seriously, just use some handy ajax functions, if you have the Possibility include jquers

  • Add an Event Listener on the Element (instead of onclick)
  • on click (event) get the id of the elment that has been clicked on using this
  • use the id to make an ajax call on a php script that then returns the html you want
  • append that html where you want

Sounds like you should be using a separate form for each row. You can identify the row using a hidden form input field.