xtoc Posted February 2, 2007 Share Posted February 2, 2007 My product table looks like this : Id - productname - distributor - comments - genre What i want is to create a select link after each product, when i click on this link, it should Id - productname - distributor - comments - genre - link --------------------------------------------------------- 1 - dragonfly - coltnet - none - fantasy - MySelectLinkHere 2 - mystery - forunit - none - horror - MySelectLinkHere By pressing MySelectLinkHere on the id "2" -> it will give a overview from product 2, and give you the possibility to order it Is this possible to do this by using the post command? thx, greetz Quote Link to comment Share on other sites More sharing options...
Cep Posted February 2, 2007 Share Posted February 2, 2007 Yes it is possible, for each row that you output in your table, you can output a direct html link. You do not need to use POST. Quote Link to comment Share on other sites More sharing options...
boo_lolly Posted February 2, 2007 Share Posted February 2, 2007 i would use $_GET. Quote Link to comment Share on other sites More sharing options...
Jessica Posted February 2, 2007 Share Posted February 2, 2007 $_POST is slightly more secure than GET, as less random users will know how to edit post data. Plus it looks nicer to the user than having all that junk in the URL. But to answer the original question, you'd have to make forms, and use javascript to give that link a submit function onclick. In this case, it'll be easier to use the URL and get the data with GET Quote Link to comment Share on other sites More sharing options...
boo_lolly Posted February 2, 2007 Share Posted February 2, 2007 $_POST is slightly more secure than GET, as less random users will know how to edit post data. Plus it looks nicer to the user than having all that junk in the URL. But to answer the original question, you'd have to make forms, and use javascript to give that link a submit function onclick. In this case, it'll be easier to use the URL and get the data with GET agreed. Quote Link to comment Share on other sites More sharing options...
scottybwoy Posted February 2, 2007 Share Posted February 2, 2007 Ceps option is the easiest and probably best, although it will need another page. But passing info like <a href="page.php?option=2">Client</a> can supply info to your php to bring up the relevant product info into your template. It can also be done via a button and having a func in your script to grab it, like if (isset($_POST['buy'])) then having a switch case for each 'buy' id. Hope that helps Quote Link to comment Share on other sites More sharing options...
boo_lolly Posted February 2, 2007 Share Posted February 2, 2007 Ceps option is the easiest and probably best, although it will need another page. But passing info like <a href="page.php?option=2">Client</a> can supply info to your php to bring up the relevant product info into your template. It can also be done via a button and having a func in your script to grab it, like if (isset($_POST['buy'])) then having a switch case for each 'buy' id. Hope that helps that's using the $_GET method... $_GET['option'] Quote Link to comment Share on other sites More sharing options...
Cep Posted February 2, 2007 Share Posted February 2, 2007 No actually I didnt even mention the GET method, I just meant a link pointing to each page. I was going on the assumption he had a page for each rather than a dynamic page for all. Quote Link to comment Share on other sites More sharing options...
xtoc Posted February 2, 2007 Author Share Posted February 2, 2007 thanks for all responds I want to use the same page when i showing the product details from one product . when going to the products.php -> select * from products; when pressing the second product out of the product list -> reload products.php with sql : select * from products where id = "2"; greetz Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.