Drupal: An Important Debugging PHP snippet while making forms

This Comment will be submitted for moderation and will not be accessible to other users until it has been approved.


For long I have been trying to debug and create forms on Drupal and have been using "devel" module available on the Drupal site. But, this one is the code that has rescued my efforts many a times. So I thought of posting it here:

<?php
print "<div style=\"width:500px;\"><pre>";
print_r($form); // displays all the variables available
print "</pre></div>";
?>

 

 

                                     

Post Comment

  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <c>, <cpp>, <drupal5>, <drupal6>, <java>, <javascript>, <php>, <python>, <ruby>. Beside the tag style "<foo>" it is also possible to use "[foo]". PHP source code can also be enclosed in <?php ... ?> or <% ... %>.