I suggest you put you text fields directly in a database, if you have access to such.
Here is the SQL to set up your table:
CREATE TABLE users (
id int(10) unsigned NOT NULL auto_increment,
name varchar(40) NOT NULL,
account varchar(12) NOT NULL,
access varchar(12) NOT NULL,
PRIMARY KEY (id)
);
You can then insert your table data from an html form via (assuming you are using MySQL):
<?php
$hostname="localhost";
$dbusername="myname";
$dbpassword="mypass";
$database="mydatabasename";
mysql_connect($hostname,$dbusername,$dbpassword) or die("Could not connect to the database");
@mysql_select_db($database) or die("Could not select the appropriate database");
$insert_statement="INSERT INTO users VALUES (null,'$name','$account','$access')"; /This assumes you named three text fields 'name','account', and 'access' in the calling form /
$insert_query=mysql_query($insert_statement) or die("Could not perform the insert query:<br><br>$insert_statement");
?>
Then to get your info and reorder it as you want (let's call this script display.php):
<?php
// Connect to database as above
if(!isset($col)){ / Set default column by which to order your info /
$col="name";
}
if(!isset($order)){ / Set default order for your info /
$order="ASC";
}
/ Set new column order /
($order=="ASC")?($order_new=="DESC")🙁$order_new=="ASC");
$user_query="SELECT name,account,access FROM users ORDER BY $col $order";
$user_result=mysql_query($user_query);
while(list($name,$account,$access)=mysql_fetch_row($user_result)){
$table_rows.="<tr><td>$name</td><td>$account</td><td>$access</td></tr>";
}
?>
<head><title>My account info</title></head>
<body>
<table>
"<tr><td><a href="display.php?col=name&order=<?php echo"$order_new";?>">name</a></td><td><a href="display.php?col=account&order=<?php echo"$order_new";?>">$account</a></td><td><a href="display.php?col=access&order=<?php echo"$order_new";?>">$access</a></td></tr>
<?php echo"$table_rows";?>
</table>
</body>
Now you can simply click on the column header to order by that column's info and click on the same column header again to reverse the order.
Hope this helps.