I have a webpage with a really large MySQL query as the result. The query is changed depending on the user, so it will be different for each person. I am trying to provide a method of resorting the query by making the headers into clickable links.
My query results page is written in PHP and HTML for the most part.
For each column header, I have the following:
echo "<th id='frame_data_table'>
<a href='javascript:location.reload(true)'>XBox 360 Command</a>
</th>";
On clicking the column header link, the page will reload using the javascript in the a href. This is the most successful way I've been able to get my webpage to reload with all of the query information.
All I need to do now is figure out how to pass another variable upon clicking the header link. I have tried to do syntactical variations of something like
echo "<th id='frame_data_table'>
<a href='javascript:location.reload(true)+?var1=command_column'>XBox 360 Command</a>
</th>";
with no success. Once I get the variable to pass, I will just grab it with $_GET[''], no problem.
Any advice? It's worth noting that after extensive googling, I saw a lot of location.href
. This does not reload my page, and in fact all it really does (in Chrome, anyway) is load a page with just the text url of the page I want.
Is there any way to pass a variable in the url using javascript's location.reload()? Thanks in advance.
-Anthony
UPDATE: Solution
I asked a similar question and was able to obtain a solution. See the link here. The solution is fully explained in the bottom of the question.