Set dynamic value with custom plugin

Home Forums Quform WordPress Set dynamic value with custom plugin

This topic is: resolved
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #31795
    Labella
    Participant

    Good morning I’m new Quform user, not so expert with php, trying to populate my fields dynamically
    I have a stupid problem with the return field in the add_filter function.

    It works if I use a fixed string or number:

     while($row = $result->fetch_array()) {
    	add_filter('quform_element_value_'.$row['id_iscrizione'], function ($value) {
        	return '250';
    	});
    }

    but it doesn’t work with a variable, like:

    while($row = $result->fetch_array()) {
    	add_filter('quform_element_value_'.$row['id_iscrizione'], function ($value) {
        	return $row['prezzo'];
    	});
    }

    I know that the array contains valid values, simply testing with php file:

    while($row = $result->fetch_array()) {
    	echo $row['id_iscrizione']." | ";
        echo $row['prezzo']."<br>";
    }

    I have this results:

    Suono | 250
    Protools | 200
    Producer | 300
    Arrangiamento | 300
    Mixaggio | 200
    Elettronica1 | 150
    Elettronica2 | 300
    Tecnico-Live | 250
    Logic | 200

    What did I did wrong?

    #31797
    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

    #31799
    Labella
    Participant

    Thank you, it works!

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.
Be inspired. © 2024 ThemeCatcher Ltd. 20-22 Wenlock Road, London, England, N1 7GU | Company No. 08120384 | Built with React | Privacy Policy