• I have a form opened and closed thourgh PHP shortcodes. This form contains HTML blocks(im using elementor). I want to set a PHP variable for the value of some form inputs but ther PHP code prints out as plain text so the value is “<?php $whatever ?>”.

    How can I use PHP code there? the form starts after a <?php and ends before ?> so that should be a PHP block.

    Sorry for my english feel free to ask if you don’tudnersand and thank you.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Is there are a reason why you cannot use a plugin such as NinjaForms or Gravity Forms?

    Moderator bcworkz

    (@bcworkz)

    There are plugins that allow one to enter PHP code in the editor. I don’t recommend them, but they do exist. They may not be compatible with Elementor as well, IDK. If you want values from PHP to appear in content, it’s best done from an action hook or template. This doesn’t give you much flexibility though. For more flexibility, your PHP could be part of a shortcode handler. You can modify the existing shortcode, or override it with your own handler function. AFAIK, placing another shortcode within shortcode content doesn’t normally work unless the outer shortcode handler first runs its content through do_shortcode().

    BTW, I see no reason for an apology in your use of English. It’s always those with very good non-native English who apologize 🙂

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

The topic ‘Inserting PHP variable into HTML form’ is closed to new replies.