PHP zoekfunctie in sql
Pagina: « vorige 1 2 3 4 5 volgende »
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Debitel Sales Tool - Hoofdpagina</title>
</head>
<body>
<body text="#668014">
<body link="#009ACD">
<body vlink="#556B2F">
<body alink="#009ACD">
<table width="1024" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td height="81" colspan="5" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="1024" height="81" background="images/ja.jpg"><div align="center">
</div></td>
</tr>
</table></td>
</tr>
<tr>
<td width="192" rowspan="2" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="325" height="602" valign="top" background="images/Company-Boxed_SideBox.jpg"><blockquote>
<p> </p>
<p align="center">Hier vind je de laatste info!<br />
"info"</p>
</blockquote></td>
</tr>
</table></td>
<td width="208" height="107" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="208" height="107" align="center" valign="middle" background="images/Company-Boxed_TobBox_01.jpg"><div align="center">
<h2><a href="index.html">Home</a></h2>
</div></td>
</tr>
</table></td>
<td width="208" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td color="#668014" width="208" height="107" align="center" valign="middle" background="images/Company-Boxed_TobBox_02.jpg"><div align="center">
<h2><a href="aanbiedingdoen.html">Aanbieding doen</a></h2>
</div></td>
</tr>
</table></td>
<td width="208" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="208" height="107" align="center" valign="middle" background="images/Company-Boxed_TobBox_03.jpg"><h2 align="center"><a href="Argumentatie.html">Argumentatie</a></h2
></td>
</tr>
</table></td>
<td width="208" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="208" height="107" align="center" valign="middle" background="images/Company-Boxed_TobBox_04.jpg"><div align="center">
<h2><a href="Toestelinfo.html">Toestel info</a></h2>
</div></td>
</tr>
</table></td>
</tr>
<tr>
<td height="495" colspan="4" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="832" height="495" align="center" valign="top" background="images/Company-Boxed_MainBox.jpg"><div align="center">
<p> </p>
<blockquote><br>
<h2>Kies hieronder aan welke eigenschappen het toestel moet voldoen.</h2>
<br>
<br>
<form method="post" action="">
Code (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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
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
<?php
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
if ($_POST['merk'] != 'geen voorkeur') {
$voorwaarden = '';
$and = false;
}
else {
$voorwaarden = "WHERE merk LIKE '".$_POST['merk']."'";
$and = true;
}
if (isset ($_POST['camera'])) {
if ($and) {
$voorwaarden = ' AND camera = 1';
}
else {
$voorwaarden = 'WHERE camera = 1';
$and = true;
}
}
if (isset ($_POST['bluetooth'])) {
if ($and) {
$voorwaarden = ' AND bluetooth = 1';
}
else {
$voorwaarden = 'WHERE bluetooth = 1';
$and = true;
}
}
if (isset ($_POST['umts'])) {
if ($and) {
$voorwaarden = ' AND umts = 1';
}
else {
$voorwaarden = 'WHERE umts = 1';
$and = true;
}
}
$sql = "
SELECT veld1, veld2
FROM tabel
" . $voorwaarden;
// hierna je query uitvoeren
}
?>
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
if ($_POST['merk'] != 'geen voorkeur') {
$voorwaarden = '';
$and = false;
}
else {
$voorwaarden = "WHERE merk LIKE '".$_POST['merk']."'";
$and = true;
}
if (isset ($_POST['camera'])) {
if ($and) {
$voorwaarden = ' AND camera = 1';
}
else {
$voorwaarden = 'WHERE camera = 1';
$and = true;
}
}
if (isset ($_POST['bluetooth'])) {
if ($and) {
$voorwaarden = ' AND bluetooth = 1';
}
else {
$voorwaarden = 'WHERE bluetooth = 1';
$and = true;
}
}
if (isset ($_POST['umts'])) {
if ($and) {
$voorwaarden = ' AND umts = 1';
}
else {
$voorwaarden = 'WHERE umts = 1';
$and = true;
}
}
$sql = "
SELECT veld1, veld2
FROM tabel
" . $voorwaarden;
// hierna je query uitvoeren
}
?>
<table>
<tr>
<td><font face="arial" size=2>Welk merk toestel moet het zijn?</font><br><font size=1 face=arial>Kies uit een merk of geen aan "geen voorkeur".</font></td>
<td><select name="merk" style="background-color: #dcdcdc; border: 1px solid #000000;">
<option value="geen voorkeur">geen voorkeur</option>
<option value="Blackberry">Blackberry</option>
<option value="Imate">Imate</option>
<option value="LG">LG</option>
<option value="Motorola">Motorola</option>
<option value="Nokia">Nokia</option>
<option value="Samsung">Samsung</option>
<option value="Sharp">Sharp</option>
<option value="Siemens">Siemens</option>
<option value="Sony-Ericsson">Sony-Ericsson</option>
</select></td>
</tr>
<tr>
<td><font face="arial" size=2>Wilt u een camera op de telefoon?</font><br><font size=1 face=arial>Vink aan indien de klant een camera wenst.</font></td>
<td><input name="camera" type="checkbox" value="camera"></td>
</tr>
<tr>
<td><font face="arial" size=2>Wilt u bluetooth op uw toestel?</font><br><font size=1 face=arial>Vink aan indien de klant bluetooth wenst.</font>
<br><font size=1 face=arial><A HREF="bluetooth.html" onClick="popup = window.open('bluetooth.html', 'PopupPage', 'height=450,width=500,scrollbars=yes,resizable=yes'); return false" target="_blank">Wat is bluetooth?</a>
</font></td>
<td><input name="bluetooth" type="checkbox" value="bluetooth"></td>
</tr>
<tr>
<td><font face="arial" size=2>Wilt u een UMTS toestel?</font><br><font size=1 face=arial>Vink aan indien de klant een UMTS toestel wenst.</font><br><font size=1 face=arial> <A HREF="UMTS.html" onClick="popup = window.open('UMTS.html', 'PopupPage', 'height=450,width=500,scrollbars=yes,resizable=yes'); return false" target="_blank">Wat is UMTS?</a>
</font></td>
<td><input name="umts" type="checkbox" value="umts"></td>
</tr>
<br>
<tr>
<td><input type="submit" Value="Nu zoeken" style="background-color: #dcdcdc; border: 1 solid #000000"> <input type="reset" Value="Ik doe iets fout" style="background-color: #dcdcdc; border: 1 solid #000000"></td>
</tr>
</table>
</form>
</blockquote>
</div></td>
</tr>
</table></td>
</tr>
<tr>
<td height="85" colspan="5" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="1024" height="85" align="center" valign="bottom" background="images/ja.jpg"><div align="center">
<h5>Copyright (c) 2006 <a href="mailto:[email protected]">Mike</a></h5>
</div></td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
dit is die hele pagina
volgens mij doe ik veel fout
Nou, je connect bijvoorbeeld niet met een database en als je wilt zoeken is dat wel nodig.
Ik heb een deel van je code even veranderd. Plak eens over de oude code heen zodat ik kan testen hoe de query er uit ziet?
waar staat die code?
<form method="post" action="">
Code (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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
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
<?php
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
if ($_POST['merk'] != 'geen voorkeur') {
$voorwaarden = 1;
$and = false;
}
else {
$voorwaarden = "WHERE merk LIKE '".$_POST['merk']."'";
$and = true;
}
if (isset ($_POST['camera'])) {
if ($and) {
$voorwaarden = ' AND camera = 1';
}
else {
$voorwaarden = 'WHERE camera = 1';
$and = true;
}
}
if (isset ($_POST['bluetooth'])) {
if ($and) {
$voorwaarden = ' AND bluetooth = 1';
}
else {
$voorwaarden = 'WHERE bluetooth = 1';
$and = true;
}
}
if (isset ($_POST['umts'])) {
if ($and) {
$voorwaarden = ' AND umts = 1';
}
else {
$voorwaarden = 'WHERE umts = 1';
$and = true;
}
}
$sql = "
SELECT veld1, veld2
FROM tabel
" . $voorwaarden;
// hierna je query uitvoeren
echo $sql;
}
?>
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
if ($_POST['merk'] != 'geen voorkeur') {
$voorwaarden = 1;
$and = false;
}
else {
$voorwaarden = "WHERE merk LIKE '".$_POST['merk']."'";
$and = true;
}
if (isset ($_POST['camera'])) {
if ($and) {
$voorwaarden = ' AND camera = 1';
}
else {
$voorwaarden = 'WHERE camera = 1';
$and = true;
}
}
if (isset ($_POST['bluetooth'])) {
if ($and) {
$voorwaarden = ' AND bluetooth = 1';
}
else {
$voorwaarden = 'WHERE bluetooth = 1';
$and = true;
}
}
if (isset ($_POST['umts'])) {
if ($and) {
$voorwaarden = ' AND umts = 1';
}
else {
$voorwaarden = 'WHERE umts = 1';
$and = true;
}
}
$sql = "
SELECT veld1, veld2
FROM tabel
" . $voorwaarden;
// hierna je query uitvoeren
echo $sql;
}
?>
gedaan
dit lijkt mij ook niet best
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Debitel Sales Tool - Hoofdpagina</title>
</head>
<body>
<body text="#668014">
<body link="#009ACD">
<body vlink="#556B2F">
<body alink="#009ACD">
<table width="1024" border="0" cellpadding="0" cellspacing="0">
Code (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
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
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
<?php
$db = mysql_connect("localhost", "root");
interfoon_nl_db("mydb",$db);
<!--DWLayoutTable-->
<tr>
<td height="81" colspan="5" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="1024" height="81" background="images/ja.jpg"><div align="center">
<h1>Debitel Sales Tool</h1>
</div></td>
</tr>
</table></td>
</tr>
<tr>
<td width="192" rowspan="2" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="325" height="602" valign="top" background="images/Company-Boxed_SideBox.jpg"><blockquote>
<p> </p>
<p align="center">Hier vind je de laatste info!<br />
"info"</p>
</blockquote>
$result = mysql_query("SELECT * FROM products",$db);
echo "<table border=1>\n";
echo "<tr><td>merk</td><td>model</tr>\n";
while ($myrow = mysql_fetch_row($result)) {
printf("<tr><td>%s %s</td><td>%s</td></tr>\n",
$myrow[1], $myrow[2], $myrow[3]);
}
echo "</table>\n";
?>
$db = mysql_connect("localhost", "root");
interfoon_nl_db("mydb",$db);
<!--DWLayoutTable-->
<tr>
<td height="81" colspan="5" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="1024" height="81" background="images/ja.jpg"><div align="center">
<h1>Debitel Sales Tool</h1>
</div></td>
</tr>
</table></td>
</tr>
<tr>
<td width="192" rowspan="2" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="325" height="602" valign="top" background="images/Company-Boxed_SideBox.jpg"><blockquote>
<p> </p>
<p align="center">Hier vind je de laatste info!<br />
"info"</p>
</blockquote>
$result = mysql_query("SELECT * FROM products",$db);
echo "<table border=1>\n";
echo "<tr><td>merk</td><td>model</tr>\n";
while ($myrow = mysql_fetch_row($result)) {
printf("<tr><td>%s %s</td><td>%s</td></tr>\n",
$myrow[1], $myrow[2], $myrow[3]);
}
echo "</table>\n";
?>
</tr>
</table></td>
<td width="208" height="107" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="208" height="107" align="center" valign="middle" background="images/Company-Boxed_TobBox_01.jpg"><div align="center">
<h2><a href="index.html">Home</a></h2>
</div></td>
</tr>
</table></td>
<td width="208" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td color="#668014" width="208" height="107" align="center" valign="middle" background="images/Company-Boxed_TobBox_02.jpg"><div align="center">
<h2><a href="aanbiedingdoen.html">Aanbieding doen</a></h2>
</div></td>
</tr>
</table></td>
<td width="208" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="208" height="107" align="center" valign="middle" background="images/Company-Boxed_TobBox_03.jpg"><h2 align="center"><a href="Argumentatie.html">Argumentatie</a></h2
></td>
</tr>
</table></td>
<td width="208" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="208" height="107" align="center" valign="middle" background="images/Company-Boxed_TobBox_04.jpg"><div align="center">
<h2><a href="Toestelinfo.html">Toestel info</a></h2>
</div></td>
</tr>
</table></td>
</tr>
<tr>
<td height="495" colspan="4" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="832" height="495" align="center" valign="top" background="images/Company-Boxed_MainBox.jpg"><div align="center">
<p> </p>
<blockquote>
<p align="left"> </p>
<p align="left"><br />
</p>
<p align="left"></p>
<p align="left"> </p>
</blockquote>
</div></td>
</tr>
</table></td>
</tr>
<tr>
<td height="85" colspan="5" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="1024" height="85" align="center" valign="bottom" background="images/ja.jpg"><div align="center">
<h5>Copyright (c) 2006 <a href="mailto:[email protected]">Mike</a></h5>
</div></td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
2
3
4
5
6
7
8
9
10
11
12
<?php
// connect script
$db_host = 'xxxx';
$db_user = 'xxxx';
$db_pass = 'xxxx';
$db_name = 'xxxx';
mysql_connect ($db_host, $db_user, $db_pass);
@mysql_select_db ($db_name) or die ('Fout bij het selecteren van de database');
unset ($db_host, $db_user, $db_pass, $db_name);
?>
// connect script
$db_host = 'xxxx';
$db_user = 'xxxx';
$db_pass = 'xxxx';
$db_name = 'xxxx';
mysql_connect ($db_host, $db_user, $db_pass);
@mysql_select_db ($db_name) or die ('Fout bij het selecteren van de database');
unset ($db_host, $db_user, $db_pass, $db_name);
?>
moet ik deze dan in de resultaat pagina plaatsen of in de zoekpagina?
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Debitel Sales Tool - Hoofdpagina</title>
</head>
<body>
<body text="#668014">
<body link="#009ACD">
<body vlink="#556B2F">
<body alink="#009ACD">
<table width="1024" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td height="81" colspan="5" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="1024" height="81" background="images/ja.jpg"><div align="center">
</div></td>
</tr>
</table></td>
</tr>
<tr>
<td width="192" rowspan="2" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="325" height="602" valign="top" background="images/Company-Boxed_SideBox.jpg"><blockquote>
<p> </p>
<p align="center">Hier vind je de laatste info!<br />
"info"</p>
</blockquote></td>
</tr>
</table></td>
<td width="208" height="107" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="208" height="107" align="center" valign="middle" background="images/Company-Boxed_TobBox_01.jpg"><div align="center">
<h2><a href="index.html">Home</a></h2>
</div></td>
</tr>
</table></td>
<td width="208" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td color="#668014" width="208" height="107" align="center" valign="middle" background="images/Company-Boxed_TobBox_02.jpg"><div align="center">
<h2><a href="aanbiedingdoen.html">Aanbieding doen</a></h2>
</div></td>
</tr>
</table></td>
<td width="208" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="208" height="107" align="center" valign="middle" background="images/Company-Boxed_TobBox_03.jpg"><h2 align="center"><a href="Argumentatie.html">Argumentatie</a></h2
></td>
</tr>
</table></td>
<td width="208" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="208" height="107" align="center" valign="middle" background="images/Company-Boxed_TobBox_04.jpg"><div align="center">
<h2><a href="Toestelinfo.html">Toestel info</a></h2>
</div></td>
</tr>
</table></td>
</tr>
<tr>
<td height="495" colspan="4" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="832" height="495" align="center" valign="top" background="images/Company-Boxed_MainBox.jpg"><div align="center">
<p> </p>
<blockquote><br>
<h2>Kies hieronder aan welke eigenschappen het toestel moet voldoen.</h2>
<br>
<br>
<form method="post" action="">
="">
Code (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
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
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
<?php
// connect script
$db_host = 'localhost';
$db_user = 'interfoon';
$db_pass = '';
$db_name = 'interfoon_nl_db';
mysql_connect ($db_host, $db_user, $db_pass);
@mysql_select_db ($db_name) or die ('Fout bij het selecteren van de database');
unset ($db_host, $db_user, $db_pass, $db_name);
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
if ($_POST['merk'] != 'geen voorkeur') {
$voorwaarden = 1;
$and = false;
}
else {
$voorwaarden = "WHERE merk LIKE '".$_POST['merk']."'";
$and = true;
}
if (isset ($_POST['camera'])) {
if ($and) {
$voorwaarden = ' AND camera = 1';
}
else {
$voorwaarden = 'WHERE camera = 1';
$and = true;
}
}
if (isset ($_POST['bluetooth'])) {
if ($and) {
$voorwaarden = ' AND bluetooth = 1';
}
else {
$voorwaarden = 'WHERE bluetooth = 1';
$and = true;
}
}
if (isset ($_POST['umts'])) {
if ($and) {
$voorwaarden = ' AND umts = 1';
}
else {
$voorwaarden = 'WHERE umts = 1';
$and = true;
}
}
$sql = "
SELECT veld1, veld2
FROM products
" . $voorwaarden;
// hierna je query uitvoeren
echo $sql;
}
?>
// connect script
$db_host = 'localhost';
$db_user = 'interfoon';
$db_pass = '';
$db_name = 'interfoon_nl_db';
mysql_connect ($db_host, $db_user, $db_pass);
@mysql_select_db ($db_name) or die ('Fout bij het selecteren van de database');
unset ($db_host, $db_user, $db_pass, $db_name);
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
if ($_POST['merk'] != 'geen voorkeur') {
$voorwaarden = 1;
$and = false;
}
else {
$voorwaarden = "WHERE merk LIKE '".$_POST['merk']."'";
$and = true;
}
if (isset ($_POST['camera'])) {
if ($and) {
$voorwaarden = ' AND camera = 1';
}
else {
$voorwaarden = 'WHERE camera = 1';
$and = true;
}
}
if (isset ($_POST['bluetooth'])) {
if ($and) {
$voorwaarden = ' AND bluetooth = 1';
}
else {
$voorwaarden = 'WHERE bluetooth = 1';
$and = true;
}
}
if (isset ($_POST['umts'])) {
if ($and) {
$voorwaarden = ' AND umts = 1';
}
else {
$voorwaarden = 'WHERE umts = 1';
$and = true;
}
}
$sql = "
SELECT veld1, veld2
FROM products
" . $voorwaarden;
// hierna je query uitvoeren
echo $sql;
}
?>
<table>
<tr>
<td><font face="arial" size=2>Welk merk toestel moet het zijn?</font><br><font size=1 face=arial>Kies uit een merk of geen aan "geen voorkeur".</font></td>
<td><select name="merk" style="background-color: #dcdcdc; border: 1px solid #000000;">
<option value="geen voorkeur">geen voorkeur</option>
<option value="Blackberry">Blackberry</option>
<option value="Imate">Imate</option>
<option value="LG">LG</option>
<option value="Motorola">Motorola</option>
<option value="Nokia">Nokia</option>
<option value="Samsung">Samsung</option>
<option value="Sharp">Sharp</option>
<option value="Siemens">Siemens</option>
<option value="Sony-Ericsson">Sony-Ericsson</option>
</select></td>
</tr>
<tr>
<td><font face="arial" size=2>Wilt u een camera op de telefoon?</font><br><font size=1 face=arial>Vink aan indien de klant een camera wenst.</font></td>
<td><input name="camera" type="checkbox" value="camera"></td>
</tr>
<tr>
<td><font face="arial" size=2>Wilt u bluetooth op uw toestel?</font><br><font size=1 face=arial>Vink aan indien de klant bluetooth wenst.</font>
<br><font size=1 face=arial><A HREF="bluetooth.html" onClick="popup = window.open('bluetooth.html', 'PopupPage', 'height=450,width=500,scrollbars=yes,resizable=yes'); return false" target="_blank">Wat is bluetooth?</a>
</font></td>
<td><input name="bluetooth" type="checkbox" value="bluetooth"></td>
</tr>
<tr>
<td><font face="arial" size=2>Wilt u een UMTS toestel?</font><br><font size=1 face=arial>Vink aan indien de klant een UMTS toestel wenst.</font><br><font size=1 face=arial> <A HREF="UMTS.html" onClick="popup = window.open('UMTS.html', 'PopupPage', 'height=450,width=500,scrollbars=yes,resizable=yes'); return false" target="_blank">Wat is UMTS?</a>
</font></td>
<td><input name="umts" type="checkbox" value="umts"></td>
</tr>
<br>
<tr>
<td><input type="submit" Value="Nu zoeken" style="background-color: #dcdcdc; border: 1 solid #000000"> <input type="reset" Value="Ik doe iets fout" style="background-color: #dcdcdc; border: 1 solid #000000"></td>
</tr>
</table>
</form>
</blockquote>
</div></td>
</tr>
</table></td>
</tr>
<tr>
<td height="85" colspan="5" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="1024" height="85" align="center" valign="bottom" background="images/ja.jpg"><div align="center">
<h5>Copyright (c) 2006 <a href="mailto:[email protected]">Mike</a></h5>
</div></td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
zo ziet het er nu uit
Kee dan ga ik weer ff testen.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Debitel Sales Tool - Hoofdpagina</title>
</head>
<body>
<body text="#668014">
<body link="#009ACD">
<body vlink="#556B2F">
<body alink="#009ACD">
<table width="1024" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td height="81" colspan="5" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="1024" height="81" background="images/ja.jpg"><div align="center"> </div></td>
</tr>
</table></td>
</tr>
<tr>
<td width="192" rowspan="2" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="325" height="602" valign="top" background="images/Company-Boxed_SideBox.jpg"><blockquote>
<p> </p>
<p align="center">Hier vind je de laatste info!<br />
"info"</p>
</blockquote></td>
</tr>
</table></td>
<td width="208" height="107" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="208" height="107" align="center" valign="middle" background="images/Company-Boxed_TobBox_01.jpg"><div align="center">
<h2><a href="index.html">Home</a></h2>
</div></td>
</tr>
</table></td>
<td width="208" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td color="#668014" width="208" height="107" align="center" valign="middle" background="images/Company-Boxed_TobBox_02.jpg"><div align="center">
<h2><a href="aanbiedingdoen.html">Aanbieding doen</a></h2>
</div></td>
</tr>
</table></td>
<td width="208" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="208" height="107" align="center" valign="middle" background="images/Company-Boxed_TobBox_03.jpg"><h2 align="center"><a href="Argumentatie.html">Argumentatie</a></h2
></td>
</tr>
</table></td>
<td width="208" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="208" height="107" align="center" valign="middle" background="images/Company-Boxed_TobBox_04.jpg"><div align="center">
<h2><a href="Toestelinfo.html">Toestel info</a></h2>
</div></td>
</tr>
</table></td>
</tr>
<tr>
<td height="495" colspan="4" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="832" height="495" align="center" valign="top" background="images/Company-Boxed_MainBox.jpg"><div align="center">
<p> </p>
<blockquote><br>
<h2>Kies hieronder aan welke eigenschappen het toestel moet voldoen.</h2>
<br>
<br>
<form method="post" action="">
Code (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
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
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
<?php
// connect script
$db_host = 'localhost';
$db_user = 'interfoon';
$db_pass = '';
$db_name = 'interfoon_nl_db';
mysql_connect ($db_host, $db_user, $db_pass);
@mysql_select_db ($db_name) or die ('Fout bij het selecteren van de database');
unset ($db_host, $db_user, $db_pass, $db_name);
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
if ($_POST['merk'] != 'geen voorkeur') {
$voorwaarden = 1;
$and = false;
}
else {
$voorwaarden = "merk LIKE '".$_POST['merk']."'";
$and = true;
}
if (isset ($_POST['camera'])) {
if ($and) {
$voorwaarden = ' AND camera = 1';
}
else {
$voorwaarden = 'camera = 1';
$and = true;
}
}
if (isset ($_POST['bluetooth'])) {
if ($and) {
$voorwaarden = ' AND bluetooth = 1';
}
else {
$voorwaarden = 'bluetooth = 1';
$and = true;
}
}
if (isset ($_POST['umts'])) {
if ($and) {
$voorwaarden = ' AND umts = 1';
}
else {
$voorwaarden = 'umts = 1';
$and = true;
}
}
$sql = "
SELECT veld1, veld2
FROM products
WHERE" . $voorwaarden;
// hierna je query uitvoeren
echo $sql;
}
?>
// connect script
$db_host = 'localhost';
$db_user = 'interfoon';
$db_pass = '';
$db_name = 'interfoon_nl_db';
mysql_connect ($db_host, $db_user, $db_pass);
@mysql_select_db ($db_name) or die ('Fout bij het selecteren van de database');
unset ($db_host, $db_user, $db_pass, $db_name);
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
if ($_POST['merk'] != 'geen voorkeur') {
$voorwaarden = 1;
$and = false;
}
else {
$voorwaarden = "merk LIKE '".$_POST['merk']."'";
$and = true;
}
if (isset ($_POST['camera'])) {
if ($and) {
$voorwaarden = ' AND camera = 1';
}
else {
$voorwaarden = 'camera = 1';
$and = true;
}
}
if (isset ($_POST['bluetooth'])) {
if ($and) {
$voorwaarden = ' AND bluetooth = 1';
}
else {
$voorwaarden = 'bluetooth = 1';
$and = true;
}
}
if (isset ($_POST['umts'])) {
if ($and) {
$voorwaarden = ' AND umts = 1';
}
else {
$voorwaarden = 'umts = 1';
$and = true;
}
}
$sql = "
SELECT veld1, veld2
FROM products
WHERE" . $voorwaarden;
// hierna je query uitvoeren
echo $sql;
}
?>
<table>
<tr>
<td><font face="arial" size=2>Welk merk toestel moet het zijn?</font><br>
<font size=1 face=arial>Kies uit een merk of geen aan "geen voorkeur".</font></td>
<td><select name="merk" style="background-color: #dcdcdc; border: 1px solid #000000;">
<option value="geen voorkeur">geen voorkeur</option>
<option value="Blackberry">Blackberry</option>
<option value="Imate">Imate</option>
<option value="LG">LG</option>
<option value="Motorola">Motorola</option>
<option value="Nokia">Nokia</option>
<option value="Samsung">Samsung</option>
<option value="Sharp">Sharp</option>
<option value="Siemens">Siemens</option>
<option value="Sony-Ericsson">Sony-Ericsson</option>
</select></td>
</tr>
<tr>
<td><font face="arial" size=2>Wilt u een camera op de telefoon?</font><br>
<font size=1 face=arial>Vink aan indien de klant een camera wenst.</font></td>
<td><input name="camera" type="checkbox" value="camera"></td>
</tr>
<tr>
<td><font face="arial" size=2>Wilt u bluetooth op uw toestel?</font><br>
<font size=1 face=arial>Vink aan indien de klant bluetooth wenst.</font> <br>
<font size=1 face=arial><A HREF="bluetooth.html" onClick="popup = window.open('bluetooth.html', 'PopupPage', 'height=450,width=500,scrollbars=yes,resizable=yes'); return false" target="_blank">Wat is bluetooth?</a> </font></td>
<td><input name="bluetooth" type="checkbox" value="bluetooth"></td>
</tr>
<tr>
<td><font face="arial" size=2>Wilt u een UMTS toestel?</font><br>
<font size=1 face=arial>Vink aan indien de klant een UMTS toestel wenst.</font><br>
<font size=1 face=arial> <A HREF="UMTS.html" onClick="popup = window.open('UMTS.html', 'PopupPage', 'height=450,width=500,scrollbars=yes,resizable=yes'); return false" target="_blank">Wat is UMTS?</a> </font></td>
<td><input name="umts" type="checkbox" value="umts"></td>
</tr>
<br>
<tr>
<td><input type="submit" Value="Nu zoeken" style="background-color: #dcdcdc; border: 1 solid #000000">
<input type="reset" Value="Ik doe iets fout" style="background-color: #dcdcdc; border: 1 solid #000000"></td>
</tr>
</table>
</form>
</blockquote>
</div></td>
</tr>
</table></td>
</tr>
<tr>
<td height="85" colspan="5" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="1024" height="85" align="center" valign="bottom" background="images/ja.jpg"><div align="center">
<h5>Copyright (c) 2006 <a href="mailto:[email protected]">Mike</a></h5>
</div></td>
</tr>
</table></td>
</tr>
</table>
</body>
</html>
ok deze heb ik geupload echter het werkt nog niet
iemand nog suggesties???
Wat lukt erniet? krijg je geen goede query, of lukt het verwerken niet?
als iemand er nog naar zou willen kijken graag.
de bedoeling is dat de zoekpagina(hieronder weergegeven) connectie maakt met de database en de bevindingen aan de hand van criteria weergeeft op een resultaatpagina.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Debitel Sales Tool - Hoofdpagina</title>
</head>
<body>
<body text="#668014">
<body link="#009ACD">
<body vlink="#556B2F">
<body alink="#009ACD">
<table width="1024" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td height="81" colspan="5" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="1024" height="81" background="images/ja.jpg"><div align="center"> </div></td>
</tr>
</table></td>
</tr>
<tr>
<td width="192" rowspan="2" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="325" height="602" valign="top" background="images/Company-Boxed_SideBox.jpg"><blockquote>
<p> </p>
<p align="center">Hier vind je de laatste info!<br />
"info"</p>
</blockquote></td>
</tr>
</table></td>
<td width="208" height="107" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="208" height="107" align="center" valign="middle" background="images/Company-Boxed_TobBox_01.jpg"><div align="center">
<h2><a href="index.html">Home</a></h2>
</div></td>
</tr>
</table></td>
<td width="208" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td color="#668014" width="208" height="107" align="center" valign="middle" background="images/Company-Boxed_TobBox_02.jpg"><div align="center">
<h2><a href="aanbiedingdoen.html">Aanbieding doen</a></h2>
</div></td>
</tr>
</table></td>
<td width="208" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="208" height="107" align="center" valign="middle" background="images/Company-Boxed_TobBox_03.jpg"><h2 align="center"><a href="Argumentatie.html">Argumentatie</a></h2
></td>
</tr>
</table></td>
<td width="208" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="208" height="107" align="center" valign="middle" background="images/Company-Boxed_TobBox_04.jpg"><div align="center">
<h2><a href="Toestelinfo.html">Toestel info</a></h2>
</div></td>
</tr>
</table></td>
</tr>
<tr>
<td height="495" colspan="4" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="832" height="495" align="center" valign="top" background="images/Company-Boxed_MainBox.jpg"><div align="center">
<p> </p>
<blockquote><br>
<h2>Kies hieronder aan welke eigenschappen het toestel moet voldoen.</h2>
<br>
<br>
<form method="post" action="">
Code (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
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
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
<?php
// connect script
$db_host = 'localhost';
$db_user = 'interfoon';
$db_pass = '';
$db_name = 'interfoon_nl_db';
mysql_connect ($db_host, $db_user, $db_pass);
@mysql_select_db ($db_name) or die ('Fout bij het selecteren van de database');
unset ($db_host, $db_user, $db_pass, $db_name);
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
if ($_POST['merk'] != 'geen voorkeur') {
$voorwaarden = 1;
$and = false;
}
else {
$voorwaarden = "merk LIKE '".$_POST['merk']."'";
$and = true;
}
if (isset ($_POST['camera'])) {
if ($and) {
$voorwaarden = ' AND camera = 1';
}
else {
$voorwaarden = 'camera = 1';
$and = true;
}
}
if (isset ($_POST['bluetooth'])) {
if ($and) {
$voorwaarden = ' AND bluetooth = 1';
}
else {
$voorwaarden = 'bluetooth = 1';
$and = true;
}
}
if (isset ($_POST['umts'])) {
if ($and) {
$voorwaarden = ' AND umts = 1';
}
else {
$voorwaarden = 'umts = 1';
$and = true;
}
}
$sql = "
SELECT merk, model, kort, prijs, link
FROM products
WHERE" . $voorwaarden;
// hierna je query uitvoeren
echo $sql;
}
?>
// connect script
$db_host = 'localhost';
$db_user = 'interfoon';
$db_pass = '';
$db_name = 'interfoon_nl_db';
mysql_connect ($db_host, $db_user, $db_pass);
@mysql_select_db ($db_name) or die ('Fout bij het selecteren van de database');
unset ($db_host, $db_user, $db_pass, $db_name);
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
if ($_POST['merk'] != 'geen voorkeur') {
$voorwaarden = 1;
$and = false;
}
else {
$voorwaarden = "merk LIKE '".$_POST['merk']."'";
$and = true;
}
if (isset ($_POST['camera'])) {
if ($and) {
$voorwaarden = ' AND camera = 1';
}
else {
$voorwaarden = 'camera = 1';
$and = true;
}
}
if (isset ($_POST['bluetooth'])) {
if ($and) {
$voorwaarden = ' AND bluetooth = 1';
}
else {
$voorwaarden = 'bluetooth = 1';
$and = true;
}
}
if (isset ($_POST['umts'])) {
if ($and) {
$voorwaarden = ' AND umts = 1';
}
else {
$voorwaarden = 'umts = 1';
$and = true;
}
}
$sql = "
SELECT merk, model, kort, prijs, link
FROM products
WHERE" . $voorwaarden;
// hierna je query uitvoeren
echo $sql;
}
?>
<table>
<tr>
<td><font face="arial" size=2>Welk merk toestel moet het zijn?</font><br>
<font size=1 face=arial>Kies uit een merk of geen aan "geen voorkeur".</font></td>
<td><select name="merk" style="background-color: #dcdcdc; border: 1px solid #000000;">
<option value="geen voorkeur">geen voorkeur</option>
<option value="Blackberry">Blackberry</option>
<option value="Imate">Imate</option>
<option value="LG">LG</option>
<option value="Motorola">Motorola</option>
<option value="Nokia">Nokia</option>
<option value="Samsung">Samsung</option>
<option value="Sharp">Sharp</option>
<option value="Siemens">Siemens</option>
<option value="Sony-Ericsson">Sony-Ericsson</option>
</select></td>
</tr>
<tr>
<td><font face="arial" size=2>Wilt u een camera op de telefoon?</font><br>
<font size=1 face=arial>Vink aan indien de klant een camera wenst.</font></td>
<td><input name="camera" type="checkbox" value="camera"></td>
</tr>
<tr>
<td><font face="arial" size=2>Wilt u bluetooth op uw toestel?</font><br>
<font size=1 face=arial>Vink aan indien de klant bluetooth wenst.</font> <br>
<font size=1 face=arial><A HREF="bluetooth.html" onClick="popup = window.open('bluetooth.html', 'PopupPage', 'height=450,width=500,scrollbars=yes,resizable=yes'); return false" target="_blank">Wat is bluetooth?</a> </font></td>
<td><input name="bluetooth" type="checkbox" value="bluetooth"></td>
</tr>
<tr>
<td><font face="arial" size=2>Wilt u een UMTS toestel?</font><br>
<font size=1 face=arial>Vink aan indien de klant een UMTS toestel wenst.</font><br>
<font size=1 face=arial> <A HREF="UMTS.html" onClick="popup = window.open('UMTS.html', 'PopupPage', 'height=450,width=500,scrollbars=yes,resizable=yes'); return false" target="_blank">Wat is UMTS?</a> </font></td>
<td><input name="umts" type="checkbox" value="umts"></td>
</tr>
<br>
<tr>
<td><input type="submit" Value="Nu zoeken" style="background-color: #dcdcdc; border: 1 solid #000000">
<input type="reset" Value="Ik doe iets fout" style="background-color: #dcdcdc; border: 1 solid #000000"></td>
</tr>
</table>
</form>
</blockquote>
</div></td>
</tr>
</table></td>
</tr>
<tr>
<td height="85" colspan="5" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="1024" height="85" align="center" valign="bottom" background="images/ja.jpg"><div align="center">
<h5>Copyright (c) 2006 <a href="mailto:[email protected]">Mike</a></h5>
</div></td>
</tr>
</table></td>
</tr>
</table>
</body>
</html>
Wat is hier de bedoeling van?
<form method="post" action="">
<form method="post" action="">
kreeg van iemand de tip omdat in de resultaat pagina te veranderen
<form method="post" action="result.php">
Gewijzigd op 23/01/2006 12:37:00 door Robert Deiman
http://members.lycos.nl/interfoon/mettoestel.php
maar krijg een fout
bij de link staat de pagina
hoe los ik die fout op .
iemand een idee?