Dan Shirah wrote: > On Wed, Jan 7, 2009 at 4:54 AM, Mika Jaaksi <mika.jaaksi@xxxxxxxxx> wrote: > >> I already can get the data from database to a page. Now I want to make link >> from that data to next page and on that new page it should show all the >> data >> that is related. >> >> example: >> >> data from database >> --> >> page1 where listed: >> >> band1 (a href) >> band2 (a href) >> band3 (a href) >> ... >> >> and when clicking for example band3 >> --> >> page2 where listed band info: >> >> bandname >> bandhistory >> bandmembers >> ... >> >> So, how should I do this? Should I somehow use $_POST method to >> send/deliver >> band_id to the next page? >> > > You could do several things. > > 1) Use javascript to make a link using the band3 value within the Javascript > to pass the ID to the next page. > > Example: > > Have a Javascript function - > > <script language="JavaScript"> > <!-- > function openWin(band_id) { > var link > link = my/directory/display.php?band_id=' + band_id; > MyWin = window.open(link,"OpenPage"); > MyWin.focus(); > } > //--> > </script> > > And then call that function when you click on the band you want. > > <a href="javascript:openWin('<?php echo $band_id; ?>')"><?php echo $band; > ?></a> > > 2) You could use form objects (radio buttons/check boxes/dropdown box etc) > to pass the band_id value via POST > > Then on your second page all you would have to do is get the value. > > Example: > <input type="radio" tabindex="1" name="band" value="<?php echo $band_id; > ?>"> > <input type="radio" tabindex="2" name="band" value="<?php echo $band_id; > ?>"> > <input type="radio" tabindex="3" name="band" value="<?php echo $band_id; > ?>"> > > On the second page you would simply check the posted value of you "band" > radio input: > > $band_id = $_POST['band']; > > Hope that helps. > > Dan > Maybe too simple, but just use a get var in the link of page1: <a href="page2.php?band=1">Band1</a> <a href="page2.php?band=2">Band2</a> Then in page2 use $_GET['band'] and do your query. (of course checked and sanitized, yadayada...) -- Thanks! -Shawn http://www.spidean.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php