Précédent   Forum des professionnels en informatique > PHP > Langage > Syntaxe
Syntaxe Forum d'entraide sur la syntaxe de PHP et la POO. Avant de poster -> FAQ syntaxe, Cours d'initiation et cours de POO
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse Proposer ce sujet en actualité
 
Outils de la discussion
Publicité
'
Vieux 21/02/2011, 15h44   #1
Invité de passage
 
Lukas Haha
Inscription : février 2011
Messages : 2
Détails du profil
Informations personnelles :
Nom : Lukas Haha

Informations forums :
Inscription : février 2011
Messages : 2
Points : 0
Points : 0
Par défaut 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
looki31 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 21/02/2011, 15h50   #2
Modérateur
 
Inscription : septembre 2010
Messages : 7 101
Détails du profil
Informations forums :
Inscription : septembre 2010
Messages : 7 101
Points : 8 465
Points : 8 465
t'as crée deux fonction nommés xCalc c'est tout
__________________
http://blog.stealth35.com/
stealth35 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 22/02/2011, 19h01   #3
Invité de passage
 
Lukas Haha
Inscription : février 2011
Messages : 2
Détails du profil
Informations personnelles :
Nom : Lukas Haha

Informations forums :
Inscription : février 2011
Messages : 2
Points : 0
Points : 0
Merci de votre reponse mais maintenant il m'affiche les 4 resultat des 4 fonction alors que j'en veux que un, comment je pourrais reglé ce problème ?

Cordialement
looki31 est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse Proposer ce sujet en actualité
Outils de la discussion



Fuseau horaire GMT +2. Il est actuellement 12h59.


 
 
 
 
Partenaires

Hébergement Web