Before long, you will want to use your own functions. Here is an example of some code that declares and uses a function:
0045: <?php 0046: function in_range($numrowspara) 0047: { 0048: if ($numrowspara>=1 && $numrowspara<=10) 0049: return true; 0050: else 0051: return false; 0052: } 0053: echo "<HTML><BODY>\n"; 0054: $numrows = $_POST["numrows"]; 0055: if (! in_range($numrows)) 0056: { 0057: echo "<P>numrows is not within range: $numrows</P>\n"; 0058: echo "</BODY></HTML>\n"; 0059: return; 0060: } 0061: for ($rownum = 0; $rownum<$numrows; $rownum++) 0062: { 0063: echo "<P>hello world</P>\n"; 0064: } 0065: echo "</BODY></HTML>\n"; 0066: ?>Go to: http://www.dur.ac.uk/barry.cornelius/papers/phpintro/code/helloformcheck.htm to access a WWW form that actions the above PHP script.