'Wordpress plugin & PHP choose selected element from a drop down menu
I have these 2 functions of the same class. I need to retrive the selected element from the drop down menu but I can not. What am I doing wrong??
global $wpdb;
$results =$wpdb -> get_col("SELECT `user_login` FROM `wp_users`");
echo'<form method="post">
<select name="employees" id="employees">';
foreach ($results as $value) {
echo'<option value="' .$value . '" "> ' .$value. '</option>"';
}
'</select>';
echo '<input type="text" class="regular-text" name="first_name" value="' .var_dump($_POST). '" placeholder="Write your First Name">';
echo '<input type="text" class="regular-text" name="first_name" value="' .var_dump($_POST['employees']). '" placeholder="Write your First Name">';
echo '<input type="text" class="regular-text" name="first_name" value="' .print_r($_POST['employees']). '" placeholder="Write your First Name">';
Solution 1:[1]
I had this code on the pagename.php which calls the callback class where was located my dropdownlis.
<form method="post" action="options.php">
<?php
settings_fields( 'alecaddd_options_group' );
do_settings_sections( 'alecaddd_plugin' );
submit_button();
?>
</form>
After removing the action fild everything worked great
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Alduxo |
