PHP and HTML Forms Example:

This is the first time you have come to this form.
The variable $value is not set, so !isset($value) is true.
After you have observed the code below, try clicking
the Submit Query button without typing any text in the box.
The following code in bold (as well the function) has been executed:
	<? function show_form($value=””) {  ?>
	  <form action=”submit.php” method=”post”>
	  <input type=text name=value
	        value=”<?echo $value?>”>
	  <input type=submit>
	  </form>
	<? }  // close function  
	
	if(!isset($value)) {
        	echo $comment1;
	        show_form();
	        echo $code_comment1;
	}
	else {
	   if(empty($value)) {
	        echo $comment;
	        show_form($value);
	        echo $code_comment2;
	   }
	   else {
	        echo $comment3;
		echo ”<h3>Thank you!</h3>”;		
	        echo $code_comment3;
	   }    
	}
	?>