Title: Echo PHP inside of another PHP Echo?
Last modified: August 21, 2016

---

# Echo PHP inside of another PHP Echo?

 *  [zwade](https://wordpress.org/support/users/zwade/)
 * (@zwade)
 * [13 years ago](https://wordpress.org/support/topic/echo-php-inside-of-another-php-echo/)
 * Hey All,
 * I’m not sure if I’m wording this right but here is what I have:
 *     ```
       <?php echo do_shortcode("[nggallery id='<?php echo get_post_meta($post->ID, 'gallery_id_box', true);?>']"); ?>
       ```
   
 * I want to echo out the nextgen gallery shortcode, but have a echo inside the 
   plugin for the plugin id number. I have a custom meta box setup so that all the
   user needs to do is enter the gallery id number in the box and it will be echo’d
   out and the gallery will show on the page. The code I have above doesn’t work
   though and I need some help.
 * I thought it may have to do with my quotes but I’m just getting into php so I
   wasn’t sure. Any help is appreciated. Thanks

Viewing 1 replies (of 1 total)

 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [13 years ago](https://wordpress.org/support/topic/echo-php-inside-of-another-php-echo/#post-3762501)
 * use string concatenation; [http://php.net/manual/en/language.operators.string.php](http://php.net/manual/en/language.operators.string.php)
 * example:
 * `<?php echo do_shortcode("[nggallery id='" . get_post_meta($post->ID, 'gallery_id_box',
   true) . "']"); ?>`

Viewing 1 replies (of 1 total)

The topic ‘Echo PHP inside of another PHP Echo?’ is closed to new replies.

## Tags

 * [php](https://wordpress.org/support/topic-tag/php/)

 * 1 reply
 * 2 participants
 * Last reply from: [Michael](https://wordpress.org/support/users/alchymyth/)
 * Last activity: [13 years ago](https://wordpress.org/support/topic/echo-php-inside-of-another-php-echo/#post-3762501)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
