Display value from user input form I have this form which has 2 radio buttons. If I select the radio button labeled as one way, the return date and time will be invisible; if I select return, the return date and time will be visible. I just want to test if the data have been entered when oneway is selected. This is because when I select return, I can print out all the input values by user, but if I select oneway, I can't do so.

This is the code I am using.

echo "&lt;h1&gt;Booking&lt;/h1&gt;";
$submit = $_POST['submit'];

if ($submit) {  
  // Check the direction selected by user.
  if ($direction == "return") {
    if ($liner &amp;&amp; $direction &amp;&amp; $from &amp;&amp; $f_date &amp;&amp; $f_time &amp;&amp; $destination &amp;&amp; $t_date &amp;&amp; $t_time &amp;&amp; $txttotal) {
      echo "$liner/$direction/$from /$f_date/$f_time/ $destination/$t_date/$t_time/$txttotal  ";
    }
  }
}
In the Drupal Examples project you can find the ajax_example module with a similar form with dependent fields.

http://drupal.org/project/examples