Support

Account

Home Forums General Issues Pass the Post ID to another page Reply To: Pass the Post ID to another page

  • Ok, I got this to work. My code was actually working, I just was not able to pull in the parameter the way I originally wanted (or thought that I could). What I did was pass the Post ID parameter through the URL and then pull that parameter into my style template. Here is what I did in case it helps anyone in the future:

    I passed the Post ID into the url (I.E. http://www.mysite.com/processform/?postid=1234).

    I added this to my style template:

    <?php 
    	$url = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]" ;
    	$parts = parse_url($url);
    	parse_str($parts['query'], $query);
    	$mypostid = $query['postid'];
    ?>

    and this is how my repeater fields looked:

     <?php if(get_field('choice_menu', $mypostid)): $i = 0;?>
       <?php while(has_sub_field('choice_menu', $mypostid)): $i++;?>     
         <p><?php the_sub_field('choice_name'); ?> : $check<?php echo $i; ?></p>  
       <?php endwhile; ?>	 
     <?php endif; ?>