Zoek resulaat filteren

Overzicht Reageren

Sponsored by: Vacatures door Monsterboard

Dennis

Dennis

21/07/2008 14:41:00
Quote Anchor link
Hallo allemaal,

Mijn onderstaande script kan men vacatures zoeken...echter als je bijvoorbeeld fulltime ( doorgroeifunctie ) selecteert en de plaats hengelo, dan krijg je ook alle andere doorgroeifuncties te zien..... Hoe kan ik dat aanpassen ?

hier het script :

Code (php)
PHP script in nieuw venster Selecteer het PHP script
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
<?php
    $query
= "SELECT *
              FROM vacatures
              WHERE job_type='"
. mysql_real_escape_string($_POST['job_type']) . "'
              
              ORDER BY region DESC"
;
$result = mysql_query($query) or die(mysql_error());

?>


    <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="Post"><br />
      <h3 class="lime">Zoek vacatures</h3>
            <table id="home_search">
                <tr>
                    <th class="oranje">Dienstverband</th>
                    <th class="oranje">Beroepsgroepen</th>
                    <th class="oranje">Locaties</th>
                    <th class="oranje"></th>
                    <th class="oranje"></th>
                </tr>
                <tr>
                    <td style="vertical-align: top; text-align: right;"><select id="job_type" name="job_type"><option value=''>Kies hier...</option>
                        <option value="Fulltime ( Starter )">Fulltime ( Starter )</option>
                        <option value="Fulltime (doorgroeifunctie)">Fulltime (doorgroeifunctie)</option>
                        <option value="Stage">Stage</option>
                        <option value="Vakantiewerk">Vakantiewerk</option>
                    </select></td>
                    <td style="vertical-align: top; text-align: right;"><select id="function" name="function"><option value=''>Kies hier...</option>
                        <option value="1">Elektrotechnisch / Electronica</option>
                        <option value="2">Bouw / Civiel technisch</option>
                        <option value="3">Technisch / Klusser / Monteur</option>
                        <option value="4">Projectmanagement</option>
                        <option value="5">ICT</option>
                        <option value="6">Administratief</option>
                        <option value="7">Algemeen management</option>
                        <option value="8">Chemisch / Farmaceutisch</option>
                        <option value="9">Metaaltechnisch / Werktuigbouwkundig</option>
                        <option value="10">Personeel en Organisatie</option>
                    </select></td>
                    <td style="vertical-align: top; text-align: right;"><select id="region" name="region"><option value=''>Kies hier...</option><option value="Alkmaar">Alkmaar</option>
                        <option value="Almelo">Almelo</option>
                        <option value="Almere">Almere</option>
                        <option value="Alphen aan den Rijn">Alphen aan den Rijn</option>
                        <option value="Amersfoort">Amersfoort</option>
                        <option value="Amsterdam">Amsterdam</option>
                        <option value="Apeldoorn">Apeldoorn</option>
                        <option value="Arnhem">Arnhem</option>
                        <option value="Assen">Assen</option>
                        <option value="Baarn">Baarn</option>
                        <option value="Bergen op Zoom">Bergen op Zoom</option>
                        <option value="Breda">Breda</option>
                        <option value="Culemborg">Culemborg</option>
                        <option value="Delft">Delft</option>
                        <option value="Den Bosch">Den Bosch</option>
                        <option value="Den Haag">Den Haag</option>
                        <option value="Deventer">Deventer</option>
                        <option value="Doetinchem">Doetinchem</option>
                        <option value="Dordrecht">Dordrecht</option>
                        <option value="Drachten">Drachten</option>
                        <option value="Driebergen">Driebergen</option>
                        <option value="Dronten">Dronten</option>
                        <option value="Ede">Ede</option>
                        <option value="Eindhoven">Eindhoven</option>
                        <option value="Emmen">Emmen</option>
                        <option value="Enschede">Enschede</option>
                        <option value="Gorinchem">Gorinchem</option>
                        <option value="Gouda">Gouda</option>
                        <option value="Groningen">Groningen</option>
                        <option value="Haarlem">Haarlem</option>
                        <option value="Harderwijk">Harderwijk</option>
                        <option value="Heerenveen">Heerenveen</option>
                        <option value="Heerlen">Heerlen</option>
                        <option value="Helmond">Helmond</option>
                        <option value="Hengelo">Hengelo</option>
                        <option value="Hilversum">Hilversum</option>
                        <option value="Hoofddorp">Hoofddorp</option>
                        <option value="Hoogeveen">Hoogeveen</option>
                        <option value="Hoorn">Hoorn</option>
                        <option value="Kampen">Kampen</option>
                        <option value="Leeuwarden">Leeuwarden</option>
                        <option value="Leiden">Leiden</option>
                        <option value="Lelystad">Lelystad</option>
                        <option value="Maastricht">Maastricht</option>
                        <option value="Naaldwijk">Naaldwijk</option>
                        <option value="Nijmegen">Nijmegen</option>
                        <option value="Oosterhout">Oosterhout</option>
                        <option value="Oss">Oss</option>
                        <option value="Rijswijk">Rijswijk</option>
                        <option value="Roermond">Roermond</option>
                        <option value="Roosendaal">Roosendaal</option>
                        <option value="Rotterdam">Rotterdam</option>
                        <option value="Schiphol">Schiphol</option>
                        <option value="Sittard">Sittard</option>
                        <option value="Tilburg">Tilburg</option>
                        <option value="Uden">Uden</option>
                        <option value="Utrecht">Utrecht</option>
                        <option value="Veenendaal">Veenendaal</option>
                        <option value="Velp">Velp</option>
                        <option value="Venlo">Venlo</option>
                        <option value="Vlissingen">Vlissingen</option>
                        <option value="Waalwijk">Waalwijk</option>
                        <option value="Wageningen">Wageningen</option>
                        <option value="Zaandam">Zaandam</option>
                        <option value="Zoetermeer">Zoetermeer</option>
                        <option value="Zutphen">Zutphen</option>
                        <option value="Zwolle">Zwolle</option>
                    </select></td>
                    <td style="vertical-align: top; text-align: right;"></td>
                    <td style="vertical-align: top; text-align: right;"><input name="Submit" type="Submit" class="button" id="Submit" value="Zoek" /></td>
                </tr>
                <tr>
                    <td colspan="1" style="vertical-align: top;">
                        </td>
                    <td colspan="3" style="vertical-align: top; text-align: right;">
                        </td>
                </tr>
            </table>
    </form>

<?php
if($_SERVER['REQUEST_METHOD'] == "POST")
{

    if(isset($_POST['job_type'], $_POST['function'], $_POST['region']))
    {

        $query = "SELECT *
              FROM vacatures
              WHERE job_type='"
. mysql_real_escape_string($_POST['job_type']) . "'
              OR (job_type='"
. mysql_real_escape_string($_POST['job_type']) . "' AND function='" . mysql_real_escape_string($_POST['function']) . "')
              OR (job_type='"
. mysql_real_escape_string($_POST['job_type']) . "' AND region='" . mysql_real_escape_string($_POST['region']) . "')
              OR (job_type='"
. mysql_real_escape_string($_POST['job_type']) . "' AND region='" . mysql_real_escape_string($_POST['region']) . "' AND function='" . mysql_real_escape_string($_POST['function']) . "')
              OR function='"
. mysql_real_escape_string($_POST['function']) . "'
              OR (function='"
. mysql_real_escape_string($_POST['function']) . "' AND region='" . mysql_real_escape_string($_POST['region']) . "')
              OR region='"
. mysql_real_escape_string($_POST['region']) . "'      
              ORDER BY region ASC"
;
        $result = mysql_query($query) or die(mysql_error());
        if(mysql_num_rows($result) == 0)
        {

            echo '<table width="100%" border="0">
                    <tr>
                        <td colspan="4">Er zijn geen vacatures gevonden die aan uw criteria voldoen</td>
                    </tr>
                </table>'
;
        }

        else
        {
            echo '<table width="100%" border="0">';
            echo '<tr>
                    <td colspan="3"\><strong>De volgende vacatures zijn voor u gevonden ( gesorteerd op regio ) : </strong></td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                </tr>
                <tr>
                <td>Functie : </td>
                    <td>Dienstverband : </td>
                    <td>Regio :</td>
                    <td></td>
                    <td></td>
                </tr>'
;
                // keeps getting the next row until there are no more to get
            while($row = mysql_fetch_array( $result ))
            {

                echo '<tr>
                         <td><a href="'
.$row['url'].'" target="_blank">'.$row['titel'].'</a></td>
                         <td>'
.$row['job_type'].'</td>
                        <td>'
.$row['region'].'</td>
                        <td></td>
                        <td></td>
                    </tr>'
;
            }

            echo '</table>';
        }
    }
}

?>
 
PHP hulp

PHP hulp

23/12/2024 11:56:34
 
Spike Spade

Spike Spade

22/07/2008 14:25:00
Quote Anchor link
Oke het gaat mis in je query opbouw.

Code (php)
PHP script in nieuw venster Selecteer het PHP script
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
//Start building the query
$query = "    SELECT *
    FROM
      vacatures ";
    
$where = " WHERE ";
    
//check if a jobtype is selected
if(isset($_POST['job_type'] && $POST['job_type'] != "")
{
   $query .= $where . " job_type = '" . mysql_real_escape_string($_POST['job_type']) . "' ";
   $where = " AND ";
}
    
//check if a function is selected
if(isset($_POST['function'] && $POST['function'] != "")
{
   $query .= $where . " function = '" . mysql_real_escape_string($_POST['function']) . "' ";
   $where = " AND ";
}
    
//check if a region is selected
if(isset($_POST['region'] && $POST['region'] != "")
{
   $query .= $where . " region = '" . mysql_real_escape_string($_POST['region']) . "' ";
}

//Set sort order
$query .= " ORDER BY region ASC";
 



Overzicht Reageren

 
 

Om de gebruiksvriendelijkheid van onze website en diensten te optimaliseren maken wij gebruik van cookies. Deze cookies gebruiken wij voor functionaliteiten, analytische gegevens en marketing doeleinden. U vindt meer informatie in onze privacy statement.