0

I trying to print a form data with a shortcode but the code is printing their value

I have a Wordpress site that I need to print a form data with a shortcode, but the system is printing their value instead. The first block is my form. Second block is my shortcode content.

<div class="cidade">
<form action="" method="post">
    <select id="cidade2" name="cidade" onchange="submit();">
        <option value="augustopestana-rd2">Augusto Pestana</option>
</select>
</form>
</div>

<?php echo $_POST['cidade']; ?>

And finally I past the shortcode into a wordpress widget expeting to print "Augusto Pestana" but it's printing "augustopestana-rd2".

3
  • 1
    You explicitly set the value to augustopestana-rd2. Either remove that attribute altogether which will then submit the values option text or change it to be Augusto Pestana explicitly.
    – John Conde
    Jan 17, 2019 at 21:21
  • Do I close with this? stackoverflow.com/questions/6767748/… Surely the answer isn't as simple as reversing the values. Jan 17, 2019 at 21:48
  • If you use option tag with value it will take your value from attribute, please remove value attribute if you want to print the value. Jan 18, 2019 at 4:50

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.