I would like to populate a dynamic select option in page 2 of my webform based on the value of another select option in the previous page. I would like to use a variable in db_query, and hence tried this. But it doesn't work. I am not sure where I went wrong. Kindly let me know how I could solve this problem.

$array = array();
$major = $form_values['submitted_tree']['choose_your_major'];
$sql = db_query("SELECT data FROM webform_submitted_data WHERE nid = 2133 and cid =23 and data = '%s'", $major);
while($row = db_fetch_object($sql)) {
    $array[] = $row->data; 
return $array;
  • Drupal 6 I guess ? Are you sure the webform_submitted_data table contains datas at this point ?
    – tostinni
    Commented Dec 29, 2011 at 23:03
  • Yes Drupal 6. Here the "webform_submitted_data" query refers to info submitted via another form for company registrations. I am checking if the company's preferences for "majors recruiting" matches with that of the student's major selected and then display companies choices accordingly.
    – iRiddler
    Commented Dec 29, 2011 at 23:17


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.