Reputation: 337
I'm using advanced custom fields (ACF) to populate a custom post type and within the page is an 'email the supplier' link which opens an iframe containing a contact form. The issue I have is that the email address the form sends to will be specific to the custom field generated by the custom post type.
I've used ?postid=<?php echo the_ID(); ?>
on the end of the iframe href to carry the post ID into the iframe but I now don't know how get the ID from the url to call the correct custom field.
For example the url of the iframe is mysite.com/supplier-contact-form/?postid=40
I've tried:
<?php $postid = url_to_postid( $url ); ?>
<?php echo ($postid); ?>
but it returned the value 0.
Upvotes: 0
Views: 588
Reputation: 16
You're looking for a $GET request
<?php
$postid = $_GET['postid'];
echo $postid;
?>
Upvotes: 0