Hi all,
I got a basic php script where a person enters min and max numbers then clicks a button to generate a random number. It works but I am not so sure about the method. First here is the code:
[php]
<?php error_reporting(0); $min = $_POST['min']; $max = $_POST['max']; ?> Min No:Max No:
<?php $rand = rand($min,$max); print "The value is: $rand"; ?> [/php]
Is there any way besides using the error_reporting(0) to get the script to work. If I leave this line out the script gives errors. It seems like there should be a better option.
Also, to get the form fields to remember the numbers on refreshing the min and max variables have been echoed in the value attributes of the form - is this best practice?
Thanks,
Andy