Hi Rachel,
I wish it was that simple.
What I am trying to do is this. Pass a variable from my form the a script on anthor page.
the variable = ....?select_by=title
title could be a number of different things.
In the second script I want to use the content of the variable in place of a feild name in my table. I know I can't just use the variable as a feild name (feild names are fixed).
The outshot of the problem is this.
User selects from a list/menu on form in script 1.
The form action load script 2.
passing "http://www.mydomain.com/catalogue/booklist_by.php?select_by=title
I have my SQL staement in script 2 as :
if (isset($_GET['select_by'])) {
$colname_search_results = (get_magic_quotes_gpc()) ? $_GET['select_by'] : addslashes($_GET['select_by']);
}
$test = ($_GET['select_by']);
echo $test;
mysql_select_db($database_Chandos, $Chandos);
$query_select_by = "SELECT $test FROM chandos_books";
$select_by = mysql_query($query_select_by, $Chandos) or die(mysql_error());
$row_select_by = mysql_fetch_assoc($select_by);
$totalRows_select_by = mysql_num_rows($select_by);
The "title" part of the URL which was passed to the script 2 is the variable I want to use in place (wrong wording) of the feild name in the table.
So that the results from the table show only but all the records that have data the title feild.
Or, if the variable was "author" just to show all the authors .
Any advise, apart from go for a beer.
Kind regards
Dereck
"