-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcountitems.php
More file actions
executable file
·89 lines (72 loc) · 2.21 KB
/
Copy pathcountitems.php
File metadata and controls
executable file
·89 lines (72 loc) · 2.21 KB
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
<?
$state = false;
if ($_POST['action'] == "add") {
$conexion = mysql_connect("localhost", "root", "holamundo");
mysql_select_db("SUMA", $conexion);
$que = "INSERT INTO Suma (NUMERO1, NUMERO2, NUMERO3, TOTAL) ";
$que.= "VALUES ('".$_POST['num1']."', '".$_POST['num2']."', '".$_POST['num3']."', '".$_POST['TOTAL']."') ";
$res = mysql_query($que, $conexion) or die(mysql_error());
$state = true;
}
?>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Insertar datos en MySQL</title>
<style type="text/css">
<!--
body {
font-family: "Trebuchet MS", Tahoma, Arial;
font-size: 12px;
color: #333333;
}
h2 {
font-size: 16px;
color: #CC0000;
}
input, select {
font-family: "Trebuchet MS", Tahoma, Arial;
font-size: 11px;
color: #666666;
}
-->
</style>
<head>
<title></title>
<script>
function sumar() {
var n1 = parseInt(document.insertar.num1.value);
var n2 = parseInt(document.insertar.num2.value);
var n3 = parseInt(document.insertar.num3.value);
document.insertar.TOTAL.value=n1+n2+n3;
}
</script>
<script>
function TOTAL2() {
var num11 = parseInt(document.insertar.num11.value);
var num22 = parseInt(document.insertar.num22.value);
var num33 = parseInt(document.insertar.num33.value);
document.insertar.TOTALB.value=num11+num22+num33;
}
</script>
</head>
<body>
<h2>Insertar datos en MySQL</h2>
<form id="insertar" name="insertar" method="post" action="">
<input type="text" id="num1" onChange="sumar()" value="0" size="20">
<input type="text" id="num2" onChange="sumar()" value="0" size="20">
<input type="text" id="num3" onChange="sumar()" value="0" size="20">
<input type="text" id="TOTAL" onFocus="this.blur(); return false" value="0" size="20">
</p>
<br>
<input type="text" id="num11" onChange="TOTAL2()" value="0" size="20">
<input type="text" id="num22" onChange="TOTAL2()" value="0" size="20">
<input type="text" id="num33" onChange="TOTAL2()" value="0" size="20">
<input type="text" id="TOTALB" onFocus="this.blur(); return false" value="0" size="20">
<input type="submit" name="Submit" value="Insertar Registro" />
<input type="hidden" name="action" value="add" />
</form>
<?php if ($state) { ?>
<p><em>Registro insertado correctamente</em></p>
<?php } ?>
</body>
</html>