PHP:
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
| <html> <body> <?php if ($submit) { $db = mysql_connect("localhost", "root"); mysql_select_db("mydb",$db); $sql = "INSERT INTO employees (first,last,address,position) VALUES ('$first','$last','$address','$position')"; $result = mysql_query($sql); echo "Thank you! Information entered.\n"; } else{ ?> <form method="post" action="<?php echo $PHP_SELF ?>"> First name:<input type="Text" name="first"><br> Last name:<input type="Text" name="last"><br> Address:<input type="Text" name="address"><br> Position:<input type="Text" name="position"><br> <input type="Submit" name="submit" value="Enter information"> </form> <?php } ?> </body> </html> |
nu geeft hij deze error voor dit gedeelte [if ($submit)]
Warning: Undefined variable: submit in c:\program files\apache group\apache\htdocs\untitled0.php on line 5
is er een soms een ander manier dat ik deze code zonder die error krijg?