[Gravity Forms]Random form value


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. <?php
  2.  
  3. function get_random_field_value($form_id, $field_number){
  4. global $wpdb;
  5.  
  6. $table = RGFormsModel::get_lead_details_table_name();
  7.  
  8. return $wpdb->get_var($wpdb->prepare("SELECT value FROM $table WHERE form_id = %d AND field_number = %d ORDER BY rand() LIMIT 1", $form_id, $field_number));
  9. }
  10.  
  11. echo get_random_field_value(40, 3);

URL: http://www.gravityhelp.com/forums/topic/random-form-value

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.