Follow along with the video below to see how to install our site as a web app on your home screen.
Бележка: This feature may not be available in some browsers.
<form method="POST" action="">
<input type="text" name="number1" /><br />
<input type="text" name="number2" /><br />
<input type="submit" name="submit" />
</form>
<?php
if (isset($_POST['submit'])) {
$number1 = $_POST['number1'];
$number2 = $_POST['number2'];
echo rand($number1, $number2);
}
?>
<?php
if(isset($_GET['post']) && is_numeric($_GET['x'])&& is_numeric($_GET['y'])){
$x = $_GET['x'];
$y = $_GET['y'];
echo ($x>$y)? rand($y,$x) : rand($x,$y);
}
?>
<br />
<form method="get">
<input type="text" name="x" value="" /><br />
<input type="text" name="y" value="" /><br />
<input type="submit" name="post" value="Get random" /><br />
</form>
<form action="randum.php" method="post">
<table width="200" border="1">
<tr>
<td>Стойност1</td>
<td><label for="value1"></label>
<input type="text" name="value1" id="value1"></td>
</tr>
<tr>
<td>Стойност2</td>
<td><label for="value2"></label>
<input type="text" name="value2" id="value2"></td>
</tr>
</table>
<input name="Submit" type="submit" value="Submit">
</form>
<?php
$value1=intval(htmlspecialchars(strip_slashes($_POST['value1'])));
$value2=intval(htmlspecialchars(strip_slashes($_POST['value2'])));
$integer=rand($value1,$value2);
echo $integer ;
?>
LuBaTa каза:Бутон нещо няма ли ???
<?php
if (isset($_POST['submit']))
{
$str1 = (int)$_POST['str1'];
$str2 = (int)$_POST['str2'];
echo rand($str1, $str2);
}
else
{
echo '<table border="0">
<td>Стойност 1:</td><td><input type="text" name="str1"></td>
<td>Стойност 2:</td><td><input type="text" name="str2"></td>
<td rowspan="2" colspan="2">Давай</td>
</table>';
}
?>
колега и ти като мене изаде кода за субмитаEv0luti0N каза:LuBaTa каза:Бутон нещо няма ли ???PHP:<?php if (isset($_POST['submit'])) { $str1 = (int)$_POST['str1']; $str2 = (int)$_POST['str2']; echo rand($str1, $str2); } else { echo '<table border="0"> <td>Стойност 1:</td><td><input type="text" name="str1"></td> <td>Стойност 2:</td><td><input type="text" name="str2"></td> <td rowspan="2" colspan="2">Давай</td> </table>'; } ?>
Мдам малко съм заблуден явно..stonybg каза:колега и ти като мене изаде кода за субмитаEv0luti0N каза:LuBaTa каза:Бутон нещо няма ли ???PHP:<?php if (isset($_POST['submit'])) { $str1 = (int)$_POST['str1']; $str2 = (int)$_POST['str2']; echo rand($str1, $str2); } else { echo '<table border="0"> <td>Стойност 1:</td><td><input type="text" name="str1"></td> <td>Стойност 2:</td><td><input type="text" name="str2"></td> <td rowspan="2" colspan="2">Давай</td> </table>'; } ?>![]()
<?php
if (isset($_POST['submit']))
{
$str1 = (int)$_POST['str1'];
$str2 = (int)$_POST['str2'];
echo rand($str1, $str2);
}
else
{
echo '<table border="0">
<td>Стойност 1:</td><td><input type="text" name="str1"></td>
<td>Стойност 2:</td><td><input type="text" name="str2"></td>
<td rowspan="2" colspan="2"><input type="submit" name="submit" value="Давай"></td>
</table>';
}
?>
Виж кода който съм ти дал по-горе. Този stripslashes не ти трябва в стоност с числа.LuBaTa каза:stonybg нещо не се получава
Код:Call to undefined function strip_slashes()
LuBaTa каза:stonybg нещо не се получава
Edit// Ev0luti0N и с твоя код нищо не стана.....Код:Call to undefined function strip_slashes()
function strip_slashes($value) {
$value = stripslashes($value);
$value = str_replace("/", "[fw$]", $value);
$value = str_replace(".", "[fw$]", $value);
$value = strip_tags($value);
return $value;
}
<?php
if (isset($_POST['submit']))
{
$str1 = (int)$_POST['str1'];
$str2 = (int)$_POST['str2'];
echo rand($str1, $str2);
}
else
{
echo '<form method="POST" action="">
<table border="0">
<td>Стойност 1:</td><td><input type="text" name="str1"></td>
<td>Стойност 2:</td><td><input type="text" name="str2"></td>
<td rowspan="2" colspan="2"><input type="submit" name="submit" value="Давай"></td>
</table>
</form>';
}
?>
LuBaTa каза:Да така работи, а няма ли накакъв начин да изкарва резултата на същата страница не да праща на друга....
<?php
if (isset($_POST['submit']))
{
$str1 = (int)$_POST['str1'];
$str2 = (int)$_POST['str2'];
echo rand($str1, $str2) .'<br />';
}
echo '<form method="POST" action="">
<table border="0">
<td>Стойност 1:</td><td><input type="text" name="str1"></td>
<td>Стойност 2:</td><td><input type="text" name="str2"></td>
<td rowspan="2" colspan="2"><input type="submit" name="submit" value="Давай"></td>
</table>
</form>';
?>
Ev0luti0N каза:П.П. Защо са му тези фукций като това е само число, а не променлива пълна с дивотиики. :shock: