Jump to content

Anchor tags while passing variables not working


msaz87

Recommended Posts

Hey all,

 

I've been having trouble with anchor tags and was hoping you guys might be able to help. I've got some links that sort a table by pushing a few variables through, but I also want when the page reloads and sorts for it to be shot down to where the table is.

 

My code is:

	<a href=\"hof.php?mvpsort=team&mvporder=ASC#mvp\" class=\"white\" title=\"Sort Ascending\">Δ</a> 

 

But the only browser it seems to work on is Safari... both Firefox and IE seem to ignore the anchor.

 

You can see the page at http://www.fasports.com/az/phx/hof.php and if you click the "show/hide" on "League MVP History".

 

Any help is greatly appreciated... thanks!

I just figured it was a PHP issue because there's nothing wrong related to sorting the database or anything like that.. the problem (I assume), lies within passing that anchor in the same code as the other variables... but if it sounds more appropriate in a different section I can definitely move it -- I just don't know what a better fit would be?

 

Thanks!

Firstly, you haven't posted enough code for us to be helpful. Is the code you have posted echo'd via php or what?

 

Yes... sorry... here's more, I'm just trying to cut out the excess, but I suppose too much is better than too little...

 

<a name="mvp"></a>

<?php

$mvpsort	= $_REQUEST['mvpsort'];
$mvporder	= $_REQUEST['mvporder'];

switch ($mvpsort) {

    case "year":
    	$result = mysql_query("SELECT * FROM arizona ORDER BY year ".$mvporder."")
or die(mysql_error());  
        break;
    case "season":
    	$result = mysql_query("SELECT * FROM arizona ORDER BY season ".$mvporder."")
	or die(mysql_error());  
       break;
    case "day":
    	$result = mysql_query("SELECT * FROM arizona ORDER BY day ".$mvporder."")
	or die(mysql_error());  
       break;	
     case "division":
     	$result = mysql_query("SELECT * FROM arizona ORDER BY division ".$mvporder."")
or die(mysql_error());  
        break;
    case "name":
    	$result = mysql_query("SELECT * FROM arizona ORDER BY name ".$mvporder."")
	or die(mysql_error());  
       break;
    case "team":
    	$result = mysql_query("SELECT * FROM arizona ORDER BY team ".$mvporder."")
or die(mysql_error());  
        break;	
        
default:
$result = mysql_query("SELECT * FROM arizona")
or die(mysql_error());  
}

$rowclass = 0;

// Print out the contents of the entry 
echo "<center><table class=\"records\"><tr>";
echo "
<td bgcolor=\"#003366\">

	<div style=\"width: 50%; float: left; color: white; font-weight: bold\">Year</div>
	<div style=\"width: 50%; float: right; color: white; font-weight: bold\" align=\"right\">
	<a href=\"hof.php?mvpsort=year&mvporder=ASC#mvp\" class=\"white\" title=\"Sort Ascending\">Δ</a> 
	<a href=\"hof.php?mvpsort=year&mvporder=DESC#mvp\" class=\"white\" title=\"Sort Descending\">∇</a></div>	

</td>";
echo "
<td bgcolor=\"#003366\">

	<div style=\"width: 50%; float: left; color: white; font-weight: bold\">Season</div>
	<div style=\"width: 50%; float: right; color: white; font-weight: bold\" align=\"right\">
	<a href=\"hof.php?mvpsort=season&mvporder=ASC#mvp\" class=\"white\" title=\"Sort Ascending\">Δ</a> 
	<a href=\"hof.php?mvpsort=season&mvporder=DESC#mvp\" class=\"white\" title=\"Sort Descending\">∇</a></div>

</td>";
echo "
<td bgcolor=\"#003366\">

	<div style=\"width: 50%; float: left; color: white; font-weight: bold\">Day</div>
	<div style=\"width: 50%; float: right; color: white; font-weight: bold\" align=\"right\">
	<a href=\"hof.php?mvpsort=day&mvporder=ASC#mvp\" class=\"white\" title=\"Sort Ascending\">Δ</a> 
	<a href=\"hof.php?mvpsort=day&mvporder=DESC#mvp\" class=\"white\" title=\"Sort Descending\">∇</a></div>

</td>";
echo "
<td bgcolor=\"#003366\">

	<div style=\"width: 50%; float: left; color: white; font-weight: bold\">Division</div>
	<div style=\"width: 50%; float: right; color: white; font-weight: bold\" align=\"right\">
	<a href=\"hof.php?mvpsort=division&mvporder=ASC#mvp\" class=\"white\" title=\"Sort Ascending\">Δ</a> 
	<a href=\"hof.php?mvpsort=division&mvporder=DESC#mvp\" class=\"white\" title=\"Sort Descending\">∇</a></div>	

</td>";
echo "
<td bgcolor=\"#003366\">

	<div style=\"width: 50%; float: left; color: white; font-weight: bold\">Name</div>
	<div style=\"width: 50%; float: right; color: white; font-weight: bold\" align=\"right\">
	<a href=\"hof.php?mvpsort=name&mvporder=ASC#mvp\" class=\"white\" title=\"Sort Ascending\">Δ</a> 
	<a href=\"hof.php?mvpsort=name&mvporder=DESC#mvp\" class=\"white\" title=\"Sort Descending\">∇</a></div>	

</td>";
echo "
<td bgcolor=\"#003366\">

	<div style=\"width: 50%; float: left; color: white; font-weight: bold\">Team</div>
	<div style=\"width: 50%; float: right; color: white; font-weight: bold\" align=\"right\">
	<a href=\"http://www.fasports.com/az/phx/hof.php?mvpsort=team&mvporder=ASC#mvp\" class=\"white\" title=\"Sort Ascending\">Δ</a> 
	<a href=\"hof.php?mvpsort=team&mvporder=DESC#mvp\" class=\"white\" title=\"Sort Descending\">∇</a></div>	

</td>";
echo "</tr>";

while($row = mysql_fetch_array($result)){ ?>

<tr class="row<?= $rowclass ?>"><td><? echo ($row['year']); ?></td>
<td><? echo ($row['season']); ?></td>
<td><? echo ($row['day']); ?></td>
<td><? echo ($row['division']); ?></td>
<td><a href="http://www.fasports.com/az/phx/images/mvps/<? echo ($row['photourl']); ?>" class="blue" title="View <? echo ($row['name']); ?>'s Photo" target="_blank"><? echo ($row['name']); ?></a></td>
<td><? echo ($row['team']); ?></td></tr>
<?
    $rowclass = 1 - $rowclass;
?>

<? }

echo "</table>";

?>

 

The above is all the relevant code on that page, which is included into the greater hof.php file...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.