Salut ,
j'ai un probleme dans ma page php , je veux que ma requete sql execute quand je clic sur button OK
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 <html> <FORM ACTION="test1.php" METHOD="post"> <div class="centre"><table border="0"> <td>Status</td> <td><select name="Status" > <?php include("Connection.php"); //Connexion a la base de donnée $query = mysql_query("SELECT * FROM Status");//Req Pour Select tous les champs de table Contract echo '<select>'; while ($result = mysql_fetch_assoc($query)) { echo '<option value="'.$result['Status'].'">'.$result['Status'].'</option>'; } // Execution de la req et charger les données dans la liste déroulante mysql_close($connect); ?> </select></td> </tr> <tr> <td>Author</td> <td><input type="text" name = "Author" /></td> <td>Progress_date</td> <td><input type="text" name = "Date_Progress" /></td></tr> <tr> <td>Requested J2</td> <td><input type="text" name = "Requested_J2" /></td> <td>Comment</td> <td colspan="3"><textarea name="Comment" rows="3" cols="54"></textarea></td> </tr> <input type="submit" value="Ok" > </form> <body> <?php include('Connection.php'); //if(!empty $_POST['Author'] && !empty $Author = $_POST['Author']; $Date_Progress= $_POST['Date_Progress']; $Requested_J2 = $_POST['Requested_J2']; $Comment = $_POST['Comment']; $sql='insert into Task_Progress (Author,Date_Progress,Requested_J2,Comment) values ("'.$_POST[Author].'","'.$_POST[Date_Progress].'","'.$_POST[Requested_J2].'","'.$_POST[Comment].'")' ; if (!mysql_query($sql)) { die('Error: ' . mysql_error()); } echo $_POST['Contract']; ?> </body> </html>
Partager