treehouse : what would you like to learn today?
Web Design Web Development iOS Development

[Solved] Assign a Javascript variable to a PHP variable

  • Guys! i am stuck again :( ...

    After a lot of searching i am now sure that we can not assign a Javascript variable to a PHP variable unless it resides on some other page and we use window.location.href technique. What i want to do might be done by some other trick.. here is what i want to do:

    I have a drop down menu and a table displaying some data. The drop down is populated with months. When i select any of the month it should reflect the changes in the table by querying the database. The query that i am passing use the selected date.

    Help me out please ...
  • On the select just have an onclick with window.location.href but add in ?sort=ORDER BY Price DESC

    Then in the page using PHP get the $_GET['sort'] variable and appending it to your database query string.
  • GREAT ! .. it worked .. thanks !