I am writing a PHP script now, but I really need to attach one thing to it.

The page has a table consisting of two columns, the data in these columns are the same, the user clicks on a cell in the first column, then on a cell in the second column. The script takes data from these cells and forms a link to which it sends the user.

A working example of this can be seen on the monitoring sites of exchangers, for example, bestchange.ru, a table with currencies on the right.

The question is how to implement it? can eat somewhere instructions, examples? I tried to search for myself, but did not find anything, I’m probably forming the wrong requests ...

Thank you, well, judging by the example I figured out a little, I do not need to process courses and the like.

I need more simple. There is a table:

<tr id="ti1"> <td id="dlc1" id="dlc1"><a href="#">WMZ</a></td> <td id="drc1" id="dlc1"><a href="#">WMZ</a></td> </tr> <tr id="ti2"> <td class="lc" id="dlc2"><a href="#">WMR</a></td> <td class="rc" id="drc2"><a href="#">WMR</a></td> </tr> 

Clicking on one cell, clicking on the second cell, the script takes for example the id parameter from these cells, and forms the link http: //sayt.ru/ dlc1 -to-dlc2 .html and sends the user to this link (redirection).

Well, or how to do differently?
In each cell I insert a hidden checkbox or radio with the values ​​I need when I click on the second cell, the script sends the value from the first column and the second PHP script, well, then I will process these values ​​myself ....

How to send this data?

  • this can still be organized on JS Angulyaru. A striking example of ChangeInfo.ru is user183020

1 answer 1

The answer is simple: if there is an analogue, then study thoroughly how it works.

In this case, you need to examine what happens when you click on the links in the currency selection table. And the implementation option applied on the site is not the most complicated - in the table, by clicking on the links, the clk function from javascript is called

 <table> <tr id="ti1"><td class="lc" id="dlc1"><a href="http://www.bestchange.ru/wmz-to-wme.html" id="alc1" onclick="return clk(1, 'lc')" class="">WMZ</a></td><td class="rc" id="drc1"><a href="http://www.bestchange.ru/yandex-money-to-wmz.html" id="arc1" onclick="return clk(1, 'rc')" class="">WMZ</a></td></tr> <tr id="ti2" class="alt"><td class="lc" id="dlc2"><a href="http://www.bestchange.ru/wmr-to-wme.html" id="alc2" onclick="return clk(2, 'lc')" class="">WMR</a></td><td class="rc" id="drc2"><a href="http://www.bestchange.ru/yandex-money-to-wmr.html" id="arc2" onclick="return clk(2, 'rc')" class="">WMR</a></td></tr> </table> <script type="text/javascript"> // варианты вызова // clk(1, 'lc') - "откуда" // clk(2, 'rc') - "куда" function clk(id, direct, nofollow) { // тут волшебство: найти код валюты "откуда", кода валюты "куда", сделать запрос через AJAX с курсами разных обменников (это где-то на одном сервере собирается), затем обновить таблицу курсов } </script> 

I would do all this on knockout.js or angular.js as a last resort - on jquery

  • Contact me if you need help - copist
  • Thanks for the links to info, but it will take a lot of time to figure everything out, and the script is needed as quickly as possible ... (((added a question. - arashvg
  • First you ask for information "how to do", and then "do it". To do this, you need to know at least javascript and ajax. You can do everything in the old way on the server-side, if the javascript fails. - copist