MesaFloyd Posted April 9, 2010 Share Posted April 9, 2010 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 Quote Link to comment https://forums.phpfreaks.com/topic/198107-button-to-copy-or-highlight-a-cell/ Share on other sites More sharing options...
newbtophp Posted April 9, 2010 Share Posted April 9, 2010 You'd require Javascript not PHP for this. Quote Link to comment https://forums.phpfreaks.com/topic/198107-button-to-copy-or-highlight-a-cell/#findComment-1039437 Share on other sites More sharing options...
MesaFloyd Posted April 9, 2010 Author Share Posted April 9, 2010 thanks for that "You'd require Javascript not PHP for this...." would I need JS for simple highlighting (not copying) when the button is pressed also?... or can that be done in PHP? Quote Link to comment https://forums.phpfreaks.com/topic/198107-button-to-copy-or-highlight-a-cell/#findComment-1039443 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.