Jump to content

php selecting products using the post mode


xtoc

Recommended Posts

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

Link to comment
Share on other sites

$_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

Link to comment
Share on other sites

$_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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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']

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.