Je veux passer une variable js à la variable php drupal et afficher sa valeur. Voici mon code.comment passer la variable js à la variable php drupal?
$form['title'] = array(
'#type' => 'select',
'#title' => t('titles'),
'#page callback' => 'drupal_get_form',
'#page arguments' => array('test_select'),
'#access callback' => TRUE,
'#options' => $options,
'#prefix' => '<div>',
'#postfix' => '</div>',
'#attributes' => array('onchange' => 'test_change')
);
$form['titletext'] = array(
'#type' => 'textfield',
'#title' => 'title',
);
drupal_add_js('$('.$form['title']['select'].').change(function() {
var str ="";
'.$a.' = "";
$("'.$form['title']['select'].' option:selected").each(function() {
str += $(this).text() + " ";
});
})
.change();', 'inline', 'header');
Je veux attribuer à cette variable str à la valeur ou textfield simplement attribuer cette variable à la variable php et drupal afficher sur la page.
Maintenant, je veux récupérer la date de la base de données en fonction de la sélection dans la liste déroulante. – Ahmad