Skip to content
Advertisement

get the id of selected category php [closed]

JavaScript

this line shows the name of category for example stationary..but this should be the id of selected category.is there any need to declare the id?$category_id = $_POST['category_id']; like this? i tried with this also but it gives an error of undefined index. through this link i want to show the list of products on another page associated with selected category i am on the learning phase and stuck on this issue kindly help me to sort out that

JavaScript

Advertisement

Answer

You’re not selecting the category ID in you query add the ID column to the SELECT list.

For example, instead of

JavaScript

Try doing

JavaScript

and then the ID should be returned in the data for use like…

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement