Home › Forums › Quform WordPress › Custom Bulk Options
- This topic has 11 replies, 4 voices, and was last updated 7 years ago by
Ally.
- AuthorPosts
- January 31, 2013 at 10:54 pm #2566
mtupuschies
ParticipantHi,
is there a way to add custom bulk options for the dropdown settings?
I know there are a few already but I would not really need all of them. But I would need some other custom bulk options I would like to have in the settings.Where would I cange that? I guess they are somehow stored in a table?
Or is it “just” a php file to edit?Thanks!
February 1, 2013 at 9:15 am #2570Ally
Support StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
February 4, 2013 at 9:51 pm #2618lawrencepepper
ParticipantLooking to do this but want my array to be populated with data from my database.
Here is what I have so far for creating the array.
<?php
mysql_connect('localhost', 'xxxx', 'xxxx');
mysql_select_db('qa');$query = mysql_query('SELECT company FROM qa_vendors ORDER BY company ASC');
$result = mysql_query($query);
$companies = array();
while ($row = mysql_fetch_assoc($result)){
$companies = $row['company'];
}
?>How can I then get this array to be listed as a bulk option?
Any help would be appreciated.
February 5, 2013 at 9:57 am #2625Ally
Support StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
February 5, 2013 at 2:21 pm #2644lawrencepepper
ParticipantI placed the code into my functions.php file and the Bulk Option does not show but it is not populating with the query. It is just blank.
L
February 5, 2013 at 2:39 pm #2645Ally
Support StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
February 5, 2013 at 3:05 pm #2646lawrencepepper
ParticipantYes that worked.
I tested this code on another page on the site and it works fine:
mysql_connect('localhost', 'xxx', 'xxx');
mysql_select_db('qa');
$query = "SELECT * FROM qa_vendors";$result = mysql_query($query) or die(mysql_error());
while($row = mysql_fetch_array($result)){
echo $row['company'];
echo "<br />";
}It returns the list of companies from the table.
How can I get this code to work.
Thanks for the patience, I am new to PHP and am just learning. I have a strong background in CFM so I understand the queries, just not the PHP syntax to well yet.
L
February 5, 2013 at 3:09 pm #2647lawrencepepper
ParticipantGot it to work!
used this code:
function mytheme_bulk_options($options)
{
mysql_connect('localhost', 'xxx', 'xxx');
mysql_select_db('qa');
$query = "SELECT * FROM qa_vendors";$result = mysql_query($query);
$options['Companies'] = array();
while ($row = mysql_fetch_assoc($result)){
$options['Companies'][] = $row['company'];
}
return $options;
}
add_filter('iphorm_bulk_options', 'mytheme_bulk_options');?>Thanks!
L
February 5, 2013 at 3:18 pm #2649lawrencepepper
ParticipantOk,
That worked but now that I am using it I did not think this through properly. What I am doing is building a custom web app. I have a form that people fill out, one of the elements is a Company drop down. What I need is for that drop down to dynamically populate itself with all the company names in one of my database tables. There is another form on the site which allows people to add companies to the database. When they do this the dropdown on the other form needs to refelect this without me having to go in to QUFORM and re-configure that drop down box.
Any possible way of accomplishing this?
L
February 5, 2013 at 3:38 pm #2651Ally
Support StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
May 11, 2018 at 6:58 pm #25659Sajid Unar
ParticipantI am trying this with Quform 2 but its not working, as showing blank
Whats the best way for it
Thanks
May 11, 2018 at 8:06 pm #25663Ally
Support StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
- AuthorPosts
- You must be logged in to reply to this topic.