Jump to content

Button to Copy (or highlight) a cell


MesaFloyd

Recommended Posts

Rookie here(old guy), but some <dangerous> knowledge.

I make a table that has rows called from a DB (works fine)

I need to add a column with button for each row, that when pressed, will copy to clipboard the content of a particular cell in that row ...'pcidip'...  If too complex to copy to clipboard, alternatively, perhaps just higlight the content of the cell and the user can then <cntl>C to copy to clipboard.

 

I need it to operate across all platforms (IE, Chrome, Firefox... etc)

Can this be <simply> done in PHP?

Here is what I have

... snip...

echo "<table border='1'>";
echo "<tr> <th>Username</th> <th>Password</th> <th>IP Address</th> <th>Email Address</th> <th>Chk</th> <th> Last Visit Date-Time </th> <th>Copy/Highlight IP</th> </tr>";

// keeps getting the next row until there are no more to get
while($row = mysql_fetch_array( $result ))
{
// Print out the contents of each row into a table
echo "<tr><td>";
echo $row['username'];
echo "</td><td>";
echo $row['password'];  //show the passwords
//echo " Blocked ";     //passwords are blocked - use this -or- the above, not both 
echo "</td><td>"; 
echo $row['pcidip'];
echo "</td><td>";
echo $row['email'];
echo "</td><td>";
echo $row['emailchk'];
echo "</td><td>"; 

if ($row['datetime'] < date("Y.m.d - H:i:s",time()-60*60))
	{
	echo "<font color='red'>";
	echo $row['datetime'];
	echo " (zzzz)";
	}
else
	{
	echo "<font color='green'>";
	echo $row['datetime'];
	}

echo "</td><td>";	
echo "button here";  //want button to copy 'pcidip' to clipboard <or HL> - don't know how yet
echo "</td></tr>"; 
}

Im sure this would be simple but the only thing I can find is with JS and unique to IE.

Please be gentle with me... Im not that savvy, but I try hard...

Thanks in Advance

Floyd

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.