Note that there are some explanatory texts on larger screens.

plurals
  1. POhow to display any message or data in drupal 7 .module file
    primarykey
    data
    text
    <p>how to display any message or data in mymodule.module file in drupal 7</p> <p>i have used following line but it didn't display any thing</p> <blockquote> <p>drupal_set_message(t('test message'));</p> </blockquote> <p>aslo i want to display any variable data like for example $data = "hello" </p> <p>then how to display this variable data in drupal 7</p> <p>i am new to drupal , so if any one knows please let me know . </p> <p>i have search a lot , but didn't get anything.</p> <p>thanks in advance.</p> <hr> <p>I have used folllowing code by creating module in drupal 7</p> <pre><code> &lt;?php function form_example_menu() { $items = array(); $items['form_example/form'] = array( 'title' =&gt; 'Example Form', //page title 'description' =&gt; 'A form to mess around with.', 'page callback' =&gt; 'drupal_get_form', 'page arguments' =&gt; array('form_example_form'), 'access arguments' =&gt; array('access content'), //put the name of the form here 'access callback' =&gt; TRUE ); return $items; } function form_example_form($form, &amp;$form_state) { $form['price'] = array( '#type' =&gt; 'textfield', '#title' =&gt; 'What is Your Price?', '#size' =&gt; 10, '#maxlength' =&gt; 10, '#required' =&gt; TRUE, //make this field required ); $form['submit'] = array( '#type' =&gt; 'submit', '#value' =&gt; t('Click Here!'), ); $form['form_example_form']['#submit'][] = 'form_example_form_submit'; return $form; } function form_example_form_validate(&amp;$form, &amp;$form_state) { if (!($form_state['values']['price'] &gt; 0)){ form_set_error('price', t('Price must be a positive number.')); } } function form_example_form_submit($form, &amp;$form_state) { $result = db_insert('test')-&gt;fields(array('price' =&gt; $form_state['values']['price'],))-&gt;execute(); drupal_set_message(t('Your Price was saved')); } </code></pre> <p>In above code data is inserted in database , but message didn't displaying . If you know , what is problem please let me know , i have search a lot for this problem . Thanks in advance.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload