(If you are familiar with Memcached, better) can take a look at the img.

on the third column (named 'Value'), I need to put a 'button/link' that when clicked it will display/hide the content of the cell. In a sort of javascript 'toggle' function. (i'm not sure which to use: found a nice mootools styling here but i'm stuck on how to use it in this script.

Can you help me modify this table, for the third column to display the result when a button in this cell is clicked (and then click again and hide it)?

Here is the snippet for the table:

$a = getMemcacheKeys();

echo "<table class='prettytable'><tr><th>Key</th><th>Date Set</th><th>Value</th></tr>";

foreach ($a as $key => $v)
{
	if (count($v) == 3)
	echo "<tr><td>{$key}</td><td>" . date('r',$v[1]) . "</td><td class='button'><pre>" . print_r($v[3],1) . "</pre></td></tr>\n";
}

echo "</table>";

thanks

To toggle something use jQuery and .toggle()
http://api.jquery.com/toggle/

This will toggle display:none;

Edit something like this...

<script type="text/javascript">
$('#clickme').click(function() {
  $('#cell').toggle('slow');
});
</script>
commented: thanks indeed :) +0

It's not really necesary to use jquery for that even, document.getElementById().style.display does it all.

Remember, PHP is a server side language: you can't do anything with it AFTER the user has the page on his screen, unless you want to use AJAX.
But to be honest, that sounds a little to complex for a small script like this

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.