Hello,
I hope someone can help me.
I have a webpage that posts a list of hostnames to a php script (below) and this script works fine and displays in a table format.
My goal is to have this result table be able to be sorted from clicking on the headers of the table.
I have read many web pages on doing this with static select statements, But my code is a little different in that it runs a select statement on every hostname entered in the textarea.
Can someone point me in the right direction??? Thanks Up Front…
<?php include '/var/www/fields.inc'; include '/var/www/connect.inc'; //from fields.inc $table_fields = split(",", $fields); //Clean up list of //hostnames coming //over from textarea $list = $_POST['hostt']; $list = str_replace("r","",$list); $list = str_replace("c","",$list); $list = ereg_replace("(n)+","n",$list); $list = trim($list); $host = explode("n",$list); //Dont allow an empty textarea if(empty($list)){ exit("Host name field cannot be empty."); } //Prints table headings and this is //what I want to click on to sort!! print "$table_fields[$j] | "; #print "$table_fields[$j] | "; } print "
$col_value | n"; } print "t
'; //To count and print if hostname is not in the db if(count($novaluehst) == 0){ exit; } elseif(count($novaluehst) == 1){ echo "". count( $novaluehst )." : Host not in Database." .'
'; } else{ echo "". count( $novaluehst )." : Hosts not in Database." .'
'; } foreach( $novaluehst as $hst ) { echo $hst .'
'; } mysql_free_result($result); mysql_close($connect); ?>
Rob[php][/php]