Home › Forums › General Issues › Pass the Post ID to another page › Reply To: Pass the Post ID to another page
Thanks, Elliot.
My issue is that I am wanting to create multiple forms but use only one template to style the form, so what I want to do is pass the post id from multiple forms to the one template.
So lets say I have 5 different forms, when the user hits submit, I need to send the post id of that specific form over the one style template page (I am trying to avoid creating multiple style templates).
I can easily pull over the post id to the style template but I am not sure how (or if it is possible) to substitute the post id:
If I have this in the form:
<input name="Name" type="text" value="<?php the_sub_field('name'); ?>" />
I then pull in this field in the style template by using:
$Name
I can do something similar with the post ID and naming it $post_id
, I’m just not sure how (or if) I can then us that in the repeater below to pull in the specific post ID
<?php if(get_field('choice_menu', '$post_id'));?>
<?php while(has_sub_field('choice_menu', '$post_id'));?>
Is it possible? Does that make sense in what I am trying to do?
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.