Title: Dynamic input possible?
Last modified: August 21, 2016

---

# Dynamic input possible?

 *  Resolved [Beesten](https://wordpress.org/support/users/beesten/)
 * (@beesten)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/dynamic-input-possible/)
 * Hi!
    Total beginner at this but I would like to use a dynamic value from a mysql-
   database (temperature) and put that into the shortcode to produce a gauge that
   changes accordingly to the database-value. How can this be done? Can I put a 
   variable instead of an attribute, but then where do I put the php-code where 
   the varible gets it value? Do I add the code to the plugin or… Can I use php 
   exec and put some php-code inside the shortcode? Once again, Im a total beginner
   when it comes to programming in general and wordpress in particular – but it 
   seems like good fun! Thanks in advance! Johan D
 * [http://wordpress.org/plugins/gaugepress/](http://wordpress.org/plugins/gaugepress/)

Viewing 5 replies - 1 through 5 (of 5 total)

 *  Plugin Author [Konstantinos Kouratoras](https://wordpress.org/support/users/kouratoras/)
 * (@kouratoras)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/dynamic-input-possible/#post-4202740)
 * Dear Beesten,
 * i suggest you edit the source code of the plugin, and instead of the shortcode
   parameteres, use your own database values to produce the gauge.
 * If you like my plugin, a rating would be appreciated. 🙂
 *  Thread Starter [Beesten](https://wordpress.org/support/users/beesten/)
 * (@beesten)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/dynamic-input-possible/#post-4202743)
 * Thank you for the answer! I will certanly look into trying to edit the source
   code.
    Another way I thought could work was calling the shortcode from a template
   with some additional php that does the database queries. For some reason I cant
   even get the static example shortcode to work?! I’ve made a template I’m using
   with the particular page. In the template I use following code:
 *     ```
       <?php
       echo do_shortcode('[gauge width="400px" height="220px" value="80" min="0" max="150" title="First Gauge" label="km" showminmax="true" color="#E16300" backcolor="#EDEDED" widthscale="0.8"]');
       ?>
       ```
   
 * This produces nothing unfortunately. If this would work I would like to see if
   one could pass a numeric variable, for example $distance, like this:
 *     ```
       <?php
       echo do_shortcode('[gauge width="400px" height="220px" value="'.$distance.'" min="0" max="150" title="First Gauge" label="km" showminmax="true" color="#E16300" backcolor="#EDEDED" widthscale="0.8"]');
       ?>
       ```
   
 * Any ideas why the above isn’t working?
    If I could get this to work I would officially
   adore your plugin 😉
 *  Plugin Author [Konstantinos Kouratoras](https://wordpress.org/support/users/kouratoras/)
 * (@kouratoras)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/dynamic-input-possible/#post-4202747)
 * Your code
 * `echo do_shortcode('[gauge width="400px" height="220px" value="80" min="0" max
   ="150" title="First Gauge" label="km" showminmax="true" color="#E16300" backcolor
   ="#EDEDED" widthscale="0.8"]');`
 * works perfect for me when type it an a page template.
 * Check it out again.
 *  Thread Starter [Beesten](https://wordpress.org/support/users/beesten/)
 * (@beesten)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/dynamic-input-possible/#post-4202758)
 * Alright, got it to work, seemed to matter where in the template-file I added 
   the “echo do_shortcode” thing. Worked just fine when I wrote it below the “get-
   header()” part. I’m a total beginner! Anyway it was no problem to pass a variable
   $distance to the shortcode using the code above. Efxaristo poli!
    I’m off to 
   the the rating-section 🙂
 *  Plugin Author [Konstantinos Kouratoras](https://wordpress.org/support/users/kouratoras/)
 * (@kouratoras)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/dynamic-input-possible/#post-4202759)
 * Glad to hear that! Enjoy! 🙂

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Dynamic input possible?’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/gaugepress_83a449.svg)
 * [GaugePress](https://wordpress.org/plugins/gaugepress/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/gaugepress/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/gaugepress/)
 * [Active Topics](https://wordpress.org/support/plugin/gaugepress/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/gaugepress/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/gaugepress/reviews/)

 * 5 replies
 * 2 participants
 * Last reply from: [Konstantinos Kouratoras](https://wordpress.org/support/users/kouratoras/)
 * Last activity: [12 years, 7 months ago](https://wordpress.org/support/topic/dynamic-input-possible/#post-4202759)
 * Status: resolved