boujour,

voila j'ai un souci avec le code suivant :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
<?php
$db = new PDO('mysql:host=localhost;dbname=LCDS', 'root', '');
if (isset($_GET['idv']))
{
        if ((!isset($_POST['moin'])) || (!isset($_POST['plus'])))
	{
		$idv = $_GET['idv'];
		$query=$db->prepare('SELECT * FROM vin WHERE vin_id = :idv');
		$query->bindValue(':idv',$idv,PDO::PARAM_INT);
		$query->execute();
		$data = $query->fetch();
		echo '<form action="mi.php?idv='.$data['vin_id'].'" method="post">';
		echo '<table>
		<tr>
		<th><strong>Nom</strong></th>
		<th><strong>Achat</strong></th>
		<th><strong>Vente</strong></th>
		<th><strong>Quantité</strong></th>
		<th><strong>Prix Unité</strong></th>       
		<th><strong>Prix Total H.T</strong></th>
		<th><strong>Fournisseur</strong></th>			
		<th><strong>Modifier</strong></th>			
		</tr>';
 
		echo '<tr>
		<td>'.$data['vin_nom'].'&nbsp;('.$data['vin_l'].')</td>
		<td><input type="text" name="plus" /></td>
		<td><input type="text" name="moin" /></td>
		<td>'.$data['vin_qte'].'</td>
		<td>'.$data['vin_pu'].'</td>
		<td>'.(($data['vin_qte'])*($data['vin_pu'])).'</td>
		<td>'.$data['vin_f'].'</td>
		<td><input type="submit" value="Modifier" /></td></tr>';
 
		$query->CloseCursor();
		echo '</table></form>';
	}
	elseif (isset($_POST['moin']))
	{
		$idv = $_GET['idv'];
		$query=$db->prepare('SELECT * FROM vin WHERE vin_id = :idv');
		$query->bindValue(':idv',$idv,PDO::PARAM_INT);
		$query->execute();
		$data = $query->fetch();
 
		$moin1 = $_POST['moin'];
		$moin2 = $data['vin_qte'];
		echo $moin1;
		echo '<br>';
		echo $moin2;
		echo '<br><br>';
		$moin =  '('.$moin1.') - ('.$moin2.')';
		echo $moin;
		echo '<br><br>';
		$test = '3'-'3';
		echo $test;
	}
	elseif (isset($_POST['plus']))
	{
		$idv = $_GET['idv'];
		$query=$db->prepare('SELECT * FROM vin WHERE vin_id = :idv');
		$query->bindValue(':idv',$idv,PDO::PARAM_INT);
		$query->execute();
		$data = $query->fetch();
 
		$plus1 = $_POST['plus'];
		$plus2 = $data['vin_qte'];
		$plus = ($plus1)+($plus2);
 
		echo 'lol';
		echo 'mdr';
	}		
}
else
{
	$vin = 'vin';
	$query=$db->query('SELECT * FROM `vin` ORDER BY `vin`.`vin_nom` ASC');
 
	echo '<table>
	<tr>
	<th><strong>Nom</strong></th>             
	<th><strong>Fournisseur</strong></th>       
	<th><strong>Prix Unité</strong></th>       
	<th><strong>Quantité</strong></th>       
	<th><strong>Prix Total H.T</strong></th>       
	<th><strong>Modifier</strong></th>       
	</tr>';
	while ($data = $query->fetch())
	{
		echo '<tr><td>'.$data['vin_nom'].'&nbsp;('.$data['vin_l'].')</td><td>'.$data['vin_f'].'</td><td>'.$data['vin_pu'].'</td><td>'.$data['vin_qte'].'</td><td>'.(($data['vin_qte'])*($data['vin_pu'])).'</td><td class="modif"><span class="menu4"><a href="mi.php?idv='.$data['vin_id'].'">Modifier</a></span></td></tr>';
	}
	$query->CloseCursor();
	echo '</table>';
}
?>
quand je rentre un chiffre dans le <input type="text" name="plus" /> ce la me fait :

3

() - (3)

0
alors que sa devrai m'afficher :

lolmdr
et quand je rentre un chiffre dans le <input type="text" name="moin" /> sa marche comme je le veux.

pouvez-vous m'aider ?