Reputation: 436
I populated a textarea with database records using:
<textarea name="textarea" cols="200" rows="20"> <?php
echo "Player Id\t";
while($row = mysql_fetch_array($resourcebuilt)) {
echo stripslashes($row['playerid']);
....;
....;
} ?>
But this isn't exactly 100% what I need. I need to display records in what I believe is a textarea maybe not. But the records need to be clickable so I have functionality to those records (such as edit, delete, or even add a new record to database). Something like what admin panel contains.
I search SO and the web for something similar but with no luck. So does anyone know if this is possible with <textarea> </textarea>
or do I need to using something like JavaScript or something related for the interactive functions? If possible provide examples. Thanks you.
Upvotes: 0
Views: 113
Reputation: 997
I think what you are trying to do is populate a multiline select:
http://www.w3schools.com/tags/att_select_multiple.asp (sorry for w3 schools).
Your code for this would look more like:
<select multiple id="player-id-select">
<?php
while($row = mysql_fetch_array($resourcebuilt)) {
echo '<option>'.stripslashes($row['playerid']).</option>;
....;
....;
}
?>
</select>
Any other interaction (like clicking or whatnot) is done client side via javascript/jQuery: http://jquery.com/
Upvotes: 1