Fatal error: Cannot redeclare xcalc()
Bonjour,
J'ai un problème que je n'arrive pas a régler dans mon php
Citation:
Fatal error: Cannot redeclare xcalc() (previously declared in /home/marius31/public_html/test_rec/xCalc.php:7) in /home/marius31/public_html/test_rec/xCalc.php on line 17
Code:
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
| <?php
$_POST['nombre'];
$_POST['result'];
$_POST['choix'];
if($_POST['choix'] = 1 AND isset($_POST['choix'])) {
function xCalc($nombre, $result)
{
$inconu = $_POST['result'] - $_POST['nombre'];
echo "<h1>= $inconu </h1> ";
}
xCalc(1, 2, 3);
}
if($_POST['choix2'] = 2 AND isset($_POST['choix'])) {
function xCalc($nombre, $result)
{
$inconu = $_POST['nombre'] + $_POST['result'];
echo "<h1>= $inconu </h1>";
}
xCalc(1, 2, 3);
}
if($_POST['choix3'] = 3) {
function xCalc($nombre, $result)
{
$inconu = $_POST['nombre'] / $_POST['result'];
echo "<h1>= $inconu </h1>";
}
xCalc(1, 2, 3);
}
if($_POST['choix'] = 4) {
function xCalc($nombre, $result)
{
$inconu = $_POST['result'] / $_POST['nombre'];
echo"<h1>= $inconu </h1>";
}
xCalc(1, 2, 3);
}
?> |
L'erreur est dans la ligne 17 (qui est surligné en rouge)
Code:
1 2 3 4 5 6 7 8 9
|
if($_POST['choix2'] = 2 AND isset($_POST['choix'])) {
function xCalc($nombre, $result)
{
$inconu = $_POST['nombre'] + $_POST['result'];
echo "<h1>= $inconu </h1>";
}
xCalc(1, 2, 3); |
Pouvez vous m'aider S.V.P
Merci