Replies: 0
Hi,
I’ve created a form with a dropdown field, where the values should be dynamically pre-populated from posts describing different products. I want to use the same form across different posts, with the dropdown pre-filled based on the current post’s corresponding product.
However, I cannot use the URL prepopulate feature, as it would require manipulating archive pages and recently created links to get the form pre-filled.
Here’s what I need:
- Post A: The dropdown should be pre-filled with “Product A.”
- Post B: The dropdown should be pre-filled with “Product B.”
- Post C: The dropdown should be pre-filled with “Product C.”
- and so on.
The form itself remains the same; only the pre-fill value changes depending on the current post ID.
How can I achieve this? PHP, JS? Any solution is welcome.
Thanks!