• Hello, in a WordPress page I would like run the snippet XYZ or others to display a Php variable into value attribute of input text Html element. Here my Html code:

    <input type="text" name="echoVar" value="[xyz-ips snippet="DisplayVar"] ">

    My snippet code is like this:

    <?php echo $ragsoc ?>

    It seems is not possible to run snippet calling it between double quote. Any help will be very appreciated.

    Thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi @valgo54

    You can try this type of code to display PHP value in HTML

    <input type=”text” id=”username” value=”<?php echo $variable; ?>” />
    Thread Starter valerio

    (@valgo54)

    Hi @sonalithakkar ,

    as far as i know the instruction you send me is working in a normal html/php script not in a WordPress page. Because of this I used the xyz plugin. The problem is that html value attribute interprets the <? php $variable;?>” as a text.

    Thread Starter valerio

    (@valgo54)

    Hi @sonalithakkar ,

    as a further test I created a simple Wp page with only the calls at two XYZ plugins:

    [xyz-ips snippet="settaVar"]
    [xyz-ips snippet="DisplayVar"]

    The first snippet is

    <?php
    $ragsoc="Società1";
    ?>

    The second one:

    <?php
    echo $ragsoc ;
    ?>

    The result is “ragsoc:undefined variable”. So they are two issues the first one is that plugin’s call does not run due to double quote of the html value attribute. The second is seems that the plugin “DisplayVar” does not see the variable set by the first plugin

    Thanks and sorry for my English

    Valerio

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Echo variable with php snippet XYZ’ is closed to new replies.