Hello everyone!) There is one question that has been tormenting me for 2 days already (How can I transfer the ID value by reference? Example: there is a table "files" in the Mysql DB of the field

id game section 

there are 2 become to this table

one)

 id - 1 game - 1 section - maps 

2)

 id - 2 game -2 section - maps 

There are 2 links

 <a href="files.php?section=maps">Карты для Игры 1</a> <a href="files.php?section=maps">Карты для Игры 2</a> 

QUESTION - how to display information from a table by reference without using a form, and output so that when you click on the 1st link, all infa is displayed, where the field is game = "1", and when you click on the 2nd link, all infa is displayed, where field game = "2"? in the browser, the link must be the same URL files.phpsection = game! Help solve this issue)

  • 2
    Spread the porridge on the shelves - Ale_x
  • <a href="files.php?section=maps&game=1">Карты для Игры 1</a> ? - zb '

1 answer 1

Use the form and send POST ['id']. If you want text links, use the onclick function to invoke the form submission.

 <form action="files.php?section=maps" method="post"> <input type="hidden" name="id" value="1"> <font onclick="submit()">Карты для Игры 1</font> </form> <form action="files.php?section=maps" method="post"> <input type="hidden" name="id" value="2"> <font onclick="submit()">Карты для Игры 2</font> </form> 
  • without using the form (you did not carefully read the question!) - amf1k
  • Then try pozamorachivatsya with redirects and sessions. Initially sending files.php? Section = maps & id = 1, intercept the presence of $ _GET ['id'] to record it in the session, redirect the header ("Location: site.ru/files.php?section=maps" ); and there already take $ _SESSION ['id'] and make a selection from the database. It will turn out, of course, to scrape behind the right ear with the left heel, but it will work :-). The main thing is not to forget after receiving the value of $ _SESSION ['id'] to reset this variable so that there are no false positives. - terantul
  • and if I download links through the form, how much time will I lose than simply downloading links ??? - amf1k
  • Little. My first answer is the most optimal in your case and in time and purity of the code. - terantul