0

I am displaying a list of names on a page in wordpress. And from that list of names, a user can click the name on the 'list of names' on the page. Then it will redirect to a modal. So I have now a specific name being clicked. And from that, I will display another details (like projects involve by this specific person) from another table on this specific user.

Since I have now a specific user, on my query on the modal , the condition there is the javascript variable that i passed on the modal . my question is:

How to convert a javascript variable to be compared in a query?

here is my actual query:

SELECT * FROM xyz77_projects WHERE wp_teams_team_id IN (SELECT team_id FROM xyz77_teams WHERE wp_employee_emp_id = _______ )

the blank there is the specific id of the name that is being clicked.

JazZ
  • 4,469
  • 2
  • 20
  • 40
  • 4
    Are you using ajax or is your query on your page with everything else? – Icewine May 08 '17 at 07:37
  • Please refer this question, http://stackoverflow.com/questions/21620133/how-to-assign-javascript-variable-value-to-php-variable – Ashkar May 08 '17 at 07:40
  • @Icewine , I am not using ajax ma'am.. :( so my query is on my code itself. – tenoclockam May 08 '17 at 07:51
  • 1
    I see only two ways to go here, 1) you use an ajax call and update the content of your page with the resulting data, 2) you create a hidden form in your page, take the value you want and pass it into that form with javascript and submit the form with javascript. That will create a page reload (not the best UX behavior). – Stavros Angelis May 08 '17 at 07:57
  • @StavrosAngelis yah. I am actually doing it. From the page, pass the value using javascript to the modal. anyways. thank you for the help :D I appreciate it a lot. – tenoclockam May 09 '17 at 01:27
  • @JazZ yes i know that the blank there is the specific id of the name but what i am trying to ask is that can I use the javascript variable(the one that i passed the values with) to fill in the blank. Because i tried using the variable of js , it doesnt work :( – tenoclockam May 09 '17 at 01:29

0 Answers0