numbergenerator.php
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?php
/**
* @author Tim M. <[email protected]>
* @version 1.0
* @example http://timdata.eu/editor/workspace/timdata-editor/getal.php
*/
if (isset($_POST['roll']))
{
$getal1 = $_POST['getal1'];
$getal2 = $_POST['getal2'];
if (!is_numeric($getal1) || !is_numeric($getal2))
{
exit("Je hebt geen getallen ingevoerd. Probeer het alstublieft opnieuw.");
}
else
{
if ($getal1 < $getal2)
{
$rand = mt_rand($getal1, $getal2);
echo "Het willekeurig getal is: <b>".$rand."</b><br />";
}
else
{
exit("Je begingetal is groter dan je eindgetal en dit mag jammer genoeg niet. Probeer het opnieuw.");
}
}
}
?>
<html>
<head>
<title>Random Number Generator</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap-theme.min.css">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
<style type="text/css">
body {
padding: 10px;
}
</style>
</head>
<body>
<form method="POST" action="#">
<input type='text' name='getal1' value='<?php echo isset($_POST['getal1']) ? $_POST['getal1'] : 1; ?>'> Begin Getal </input><br />
<input type='text' name='getal2' value='<?php echo isset($_POST['getal2']) ? $_POST['getal2'] : 100; ?>'> Eind Getal </input><br />
<input type='submit' name='roll' value='Klik hier om een willekeurig getal te laten genereren.'> <br />
</form>
<center>Geschreven door: <a href="http://timdev.eu">TimDev</a></center>
</body>
</html>
/**
* @author Tim M. <[email protected]>
* @version 1.0
* @example http://timdata.eu/editor/workspace/timdata-editor/getal.php
*/
if (isset($_POST['roll']))
{
$getal1 = $_POST['getal1'];
$getal2 = $_POST['getal2'];
if (!is_numeric($getal1) || !is_numeric($getal2))
{
exit("Je hebt geen getallen ingevoerd. Probeer het alstublieft opnieuw.");
}
else
{
if ($getal1 < $getal2)
{
$rand = mt_rand($getal1, $getal2);
echo "Het willekeurig getal is: <b>".$rand."</b><br />";
}
else
{
exit("Je begingetal is groter dan je eindgetal en dit mag jammer genoeg niet. Probeer het opnieuw.");
}
}
}
?>
<html>
<head>
<title>Random Number Generator</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap-theme.min.css">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
<style type="text/css">
body {
padding: 10px;
}
</style>
</head>
<body>
<form method="POST" action="#">
<input type='text' name='getal1' value='<?php echo isset($_POST['getal1']) ? $_POST['getal1'] : 1; ?>'> Begin Getal </input><br />
<input type='text' name='getal2' value='<?php echo isset($_POST['getal2']) ? $_POST['getal2'] : 100; ?>'> Eind Getal </input><br />
<input type='submit' name='roll' value='Klik hier om een willekeurig getal te laten genereren.'> <br />
</form>
<center>Geschreven door: <a href="http://timdev.eu">TimDev</a></center>
</body>
</html>