...

View Full Version : ascend / descend with GET



aprestong
10-25-2006, 09:30 PM
I cant figure out why this doesnt work.
I can specify the sort of my returned data from FileMaker by sending a paramater of "ascend" or "descend" -
So, when I try to use GET links to sort my table, I can't seem to get it to switch from descend to ascend (back and forth) by clicking the same link.
Does the error seem apparent to anyone?
I can't seem to get it.

here is my php:


<?php
$sortpref=$_GET['sortpref'];
$sortstyle=$_GET['sortstyle'];
if(!isset($_GET['sortpref']))
{
$sortpref="TimeStamp";
$sortstyle="descend";
}
?>

and here is the HTML (and php) that I'm trying to use for my links:



<tr>
<td><center><b><a href="http://blahblah/admintools.php?sortpref=TimeStamp&sortstyle=
<?php
if($sortstyle = "descend")
{
print "ascend";
}
elseif($sortstyle = "ascend")
{
print "descend";
}?>">TimeStamp</a></b></center></td>
<td><center><b><a href="http://blahblah/admintools.php?sortpref=Username">Username</a></b></center></td>
<td><center><b><a href="http://blahblah/admintools.php?sortpref=WebAccountNumber">WebAccount#</a></b></center></td>
<td><center><b><a href="http://blahblah/admintools.php?sortpref=Browser">Browser</a></b></center></td>
<td><center><b><a href="http://blahblah/admintools.php?sortpref=Version">Version</a></b></center></td>
<td><center><b><a href="http://blahblah/admintools.php?sortpref=Res">Resolution</a></b></center></td>
</tr>


My tests have only been with the first link - - I figured once I got it working I would do the same with the rest.

Does anyone have any thoughts??

ralph l mayo
10-25-2006, 09:54 PM
You're assigning the variable $sortstyle instead of testing it in the second part, you want the == operator and not =.

aprestong
10-25-2006, 09:56 PM
thanks!
I feel like a horse's ***.
I really appreciate your help!

ralph l mayo
10-25-2006, 10:03 PM
Don't feel bad, we're all taught that = is equality from so young it's very hard to go back. Using something like := for assignment and keeping = for equality is a far better language design decision in my humble.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum