hoe 'PHP_SELF omzeilen voor correcte weergave paginering
hoi alemaal,
probleempje, ik heb mijn paginering aan de praat gekregen maar hij geeft enkel de 1 ste pagina goed weer met wat hij moet weergeven de volgende paginas kloppen niet en dat komt omdat als ik op pagina 2 klik hij de php self functie aanspreekt van men zoekscriptscript waardoor er foute gegevens worden verzonden omdat men gegevens op het form worden gereset naar de standaard waarde.
<php
<form id="form1" name="form1" method="post" action="" >
<label for="select"></label>
<table width="200" border="0" align="left" cellpadding="5">
<tr>
<th scope="row"><select name="functie" id="select">
<option value="alles" selected="selected">Kies een functiegebied</option>
<option value="lasser">lasser</option>
<option value="mecanicien">Mecanicien</option>
<option value="electricien">electricien</option>
<option value="chauffeur">chauffeur</option>
</select></th>
....
....
?>
php code
<php
<ul>
probleempje, ik heb mijn paginering aan de praat gekregen maar hij geeft enkel de 1 ste pagina goed weer met wat hij moet weergeven de volgende paginas kloppen niet en dat komt omdat als ik op pagina 2 klik hij de php self functie aanspreekt van men zoekscriptscript waardoor er foute gegevens worden verzonden omdat men gegevens op het form worden gereset naar de standaard waarde.
<php
<form id="form1" name="form1" method="post" action="" >
<label for="select"></label>
<table width="200" border="0" align="left" cellpadding="5">
<tr>
<th scope="row"><select name="functie" id="select">
<option value="alles" selected="selected">Kies een functiegebied</option>
<option value="lasser">lasser</option>
<option value="mecanicien">Mecanicien</option>
<option value="electricien">electricien</option>
<option value="chauffeur">chauffeur</option>
</select></th>
....
....
?>
php code
<php
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
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
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
<?php
$tableName="kandidatengoed";
$targetpage = "platform.php";
$limit = 10;
$query = "SELECT COUNT(*) as num FROM $tableName WHERE voorkeursfunctiegebied1='".$_POST['functie']."' AND provincie='" . $_POST['provincie'] . "'";
$total_pages = mysql_fetch_array(mysql_query($query));
$total_pages = $total_pages[num];
$stages = 3;
$page = mysql_escape_string($_GET['page']);
if($page){
$start = ($page - 1) * $limit;
}else{
$start = 0;
}
// Get page data
$query1 = "SELECT * FROM kandidatengoed WHERE voorkeursfunctiegebied1='".$_POST['functie']."' AND provincie='" . $_POST['provincie'] . "' LIMIT $start, $limit";
$result = mysql_query($query1);
// Initial page num setup
if ($page == 0){$page = 1;}
$prev = $page - 1;
$next = $page + 1;
$lastpage = ceil($total_pages/$limit);
$LastPagem1 = $lastpage - 1;
$paginate = '';
if($lastpage > 1)
{
$paginate .= "<div class='paginate'>";
// Previous
if ($page > 1){
$paginate.= "<a href='$targetpage?page=$prev'>previous</a>";
}else{
$paginate.= "<span class='disabled'>previous</span>"; }
// Pages
if ($lastpage < 7 + ($stages * 2)) // Not enough pages to breaking it up
{
for ($counter = 1; $counter <= $lastpage; $counter++)
{
if ($counter == $page){
$paginate.= "<span class='current'>$counter</span>";
}else{
$paginate.= "<a href='$targetpage?page=$counter'>$counter</a>";}
}
}
elseif($lastpage > 5 + ($stages * 2)) // Enough pages to hide a few?
{
// Beginning only hide later pages
if($page < 1 + ($stages * 2))
{
for ($counter = 1; $counter < 4 + ($stages * 2); $counter++)
{
if ($counter == $page){
$paginate.= "<span class='current'>$counter</span>";
}else{
$paginate.= "<a href='$targetpage?page=$counter'>$counter</a>";}
}
$paginate.= "...";
$paginate.= "<a href='$targetpage?page=$LastPagem1'>$LastPagem1</a>";
$paginate.= "<a href='$targetpage?page=$lastpage'>$lastpage</a>";
}
// Middle hide some front and some back
elseif($lastpage - ($stages * 2) > $page && $page > ($stages * 2))
{
$paginate.= "<a href='$targetpage?page=1'>1</a>";
$paginate.= "<a href='$targetpage?page=2'>2</a>";
$paginate.= "...";
for ($counter = $page - $stages; $counter <= $page + $stages; $counter++)
{
if ($counter == $page){
$paginate.= "<span class='current'>$counter</span>";
}else{
$paginate.= "<a href='$targetpage?page=$counter'>$counter</a>";}
}
$paginate.= "...";
$paginate.= "<a href='$targetpage?page=$LastPagem1'>$LastPagem1</a>";
$paginate.= "<a href='$targetpage?page=$lastpage'>$lastpage</a>";
}
// End only hide early pages
else
{
$paginate.= "<a href='$targetpage?page=1'>1</a>";
$paginate.= "<a href='$targetpage?page=2'>2</a>";
$paginate.= "...";
for ($counter = $lastpage - (2 + ($stages * 2)); $counter <= $lastpage; $counter++)
{
if ($counter == $page){
$paginate.= "<span class='current'>$counter</span>";
}else{
$paginate.= "<a href='$targetpage?page=$counter'>$counter</a>";}
}
}
}
// Next
if ($page < $counter - 1){
$paginate.= "<a href='$targetpage?page=$next'>next</a>";
}else{
$paginate.= "<span class='disabled'>next</span>";
}
$paginate.= "</div>";
}
echo $total_pages.' Results';
// pagination
echo $paginate;
?>
$tableName="kandidatengoed";
$targetpage = "platform.php";
$limit = 10;
$query = "SELECT COUNT(*) as num FROM $tableName WHERE voorkeursfunctiegebied1='".$_POST['functie']."' AND provincie='" . $_POST['provincie'] . "'";
$total_pages = mysql_fetch_array(mysql_query($query));
$total_pages = $total_pages[num];
$stages = 3;
$page = mysql_escape_string($_GET['page']);
if($page){
$start = ($page - 1) * $limit;
}else{
$start = 0;
}
// Get page data
$query1 = "SELECT * FROM kandidatengoed WHERE voorkeursfunctiegebied1='".$_POST['functie']."' AND provincie='" . $_POST['provincie'] . "' LIMIT $start, $limit";
$result = mysql_query($query1);
// Initial page num setup
if ($page == 0){$page = 1;}
$prev = $page - 1;
$next = $page + 1;
$lastpage = ceil($total_pages/$limit);
$LastPagem1 = $lastpage - 1;
$paginate = '';
if($lastpage > 1)
{
$paginate .= "<div class='paginate'>";
// Previous
if ($page > 1){
$paginate.= "<a href='$targetpage?page=$prev'>previous</a>";
}else{
$paginate.= "<span class='disabled'>previous</span>"; }
// Pages
if ($lastpage < 7 + ($stages * 2)) // Not enough pages to breaking it up
{
for ($counter = 1; $counter <= $lastpage; $counter++)
{
if ($counter == $page){
$paginate.= "<span class='current'>$counter</span>";
}else{
$paginate.= "<a href='$targetpage?page=$counter'>$counter</a>";}
}
}
elseif($lastpage > 5 + ($stages * 2)) // Enough pages to hide a few?
{
// Beginning only hide later pages
if($page < 1 + ($stages * 2))
{
for ($counter = 1; $counter < 4 + ($stages * 2); $counter++)
{
if ($counter == $page){
$paginate.= "<span class='current'>$counter</span>";
}else{
$paginate.= "<a href='$targetpage?page=$counter'>$counter</a>";}
}
$paginate.= "...";
$paginate.= "<a href='$targetpage?page=$LastPagem1'>$LastPagem1</a>";
$paginate.= "<a href='$targetpage?page=$lastpage'>$lastpage</a>";
}
// Middle hide some front and some back
elseif($lastpage - ($stages * 2) > $page && $page > ($stages * 2))
{
$paginate.= "<a href='$targetpage?page=1'>1</a>";
$paginate.= "<a href='$targetpage?page=2'>2</a>";
$paginate.= "...";
for ($counter = $page - $stages; $counter <= $page + $stages; $counter++)
{
if ($counter == $page){
$paginate.= "<span class='current'>$counter</span>";
}else{
$paginate.= "<a href='$targetpage?page=$counter'>$counter</a>";}
}
$paginate.= "...";
$paginate.= "<a href='$targetpage?page=$LastPagem1'>$LastPagem1</a>";
$paginate.= "<a href='$targetpage?page=$lastpage'>$lastpage</a>";
}
// End only hide early pages
else
{
$paginate.= "<a href='$targetpage?page=1'>1</a>";
$paginate.= "<a href='$targetpage?page=2'>2</a>";
$paginate.= "...";
for ($counter = $lastpage - (2 + ($stages * 2)); $counter <= $lastpage; $counter++)
{
if ($counter == $page){
$paginate.= "<span class='current'>$counter</span>";
}else{
$paginate.= "<a href='$targetpage?page=$counter'>$counter</a>";}
}
}
}
// Next
if ($page < $counter - 1){
$paginate.= "<a href='$targetpage?page=$next'>next</a>";
}else{
$paginate.= "<span class='disabled'>next</span>";
}
$paginate.= "</div>";
}
echo $total_pages.' Results';
// pagination
echo $paginate;
?>
<ul>
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
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
<?php
echo "<table border='1' align='left' cellpadding='4' cellspacing='1' width='auto' bordercolor='#FFCC00'>
<tr>
<th>Voornaam</th>
<th>opleidingsniveau</th>
<th>provincie</th>
<th>Functiegebied</th>
<th>Ervaring</th>
<th>woonplaats</th>
</tr>";
while($row = mysql_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $row['voornaam'] . "</td>";
echo "<td>" . $row['opleidingsniveau'] . "</td>";
echo "<td>" . $row['provincie'] . "</td>";
echo "<td>" . $row['voorkeursfunctiegebied1'] . "</td>";
echo "<td>" . $row['ervaring'] . "</td>";
echo "<td>" . $row['woonplaats'] . "</td>";
echo "</tr>";
}
echo "</table>";
?>
echo "<table border='1' align='left' cellpadding='4' cellspacing='1' width='auto' bordercolor='#FFCC00'>
<tr>
<th>Voornaam</th>
<th>opleidingsniveau</th>
<th>provincie</th>
<th>Functiegebied</th>
<th>Ervaring</th>
<th>woonplaats</th>
</tr>";
while($row = mysql_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $row['voornaam'] . "</td>";
echo "<td>" . $row['opleidingsniveau'] . "</td>";
echo "<td>" . $row['provincie'] . "</td>";
echo "<td>" . $row['voorkeursfunctiegebied1'] . "</td>";
echo "<td>" . $row['ervaring'] . "</td>";
echo "<td>" . $row['woonplaats'] . "</td>";
echo "</tr>";
}
echo "</table>";
?>
het probleem wordt veroorzaakt omdat je met een formulier werkt met de POST methode, en met de pagination werk je met de GET methode. met andere woorden: als je op 'next' klikt komen je formuliervelden niet door en als je je formulier 'submit' dan komt er geen pagination waarde mee.
je kan het op verschillende manieren oplossen.
één manier is om het paginanummer in een hidden field op te slaan in je formulier.
je kan het op verschillende manieren oplossen.
één manier is om het paginanummer in een hidden field op te slaan in je formulier.
enig idee hoe ik het simpel oplos ik ken namelijk heel weinig php en dit lijkt me iets wat ik nooit zelf vin
Toevoeging op 23/04/2013 00:21:01:
kan ik niet gewoon post gebruiken ipv get voor de paginering?
Toevoeging op 23/04/2013 00:21:01:
kan ik niet gewoon post gebruiken ipv get voor de paginering?
wat ik zei is het simpelst.
Code (php)
1
2
3
4
5
6
7
8
9
10
11
2
3
4
5
6
7
8
9
10
11
<?php
$page = 0;
if(isset($_GET['page']))
$page = intval($_GET['page']);
else if(isset($_POST['page']))
$page = intval($_POST['page']);
?>
<form id="form1" name="form1" method="post" action=" >
<select><option>lasser etc etc</option></select>
<input type="hidden" name="page" value="<?php echo $page; ?>" />
</form>
$page = 0;
if(isset($_GET['page']))
$page = intval($_GET['page']);
else if(isset($_POST['page']))
$page = intval($_POST['page']);
?>
<form id="form1" name="form1" method="post" action=" >
<select><option>lasser etc etc</option></select>
<input type="hidden" name="page" value="<?php echo $page; ?>" />
</form>
Gewijzigd op 23/04/2013 00:38:40 door Frank Nietbelangrijk
nu toont hij men resultaten niet meer :S o wat ben ik slecht in dit
<form id="form1" name="form1" method="post" action="" >
<input type="hidden" name="page" value="" />
<label for="select"></label>
<table width="200" border="0" align="left" cellpadding="5">
<tr>
<th scope="row"><select name="functie" id="select">
<option value="alles" selected="selected">Kies een functiegebied</option>
<option value="lasser">lasser</option>
<option value="mecanicien">Mecanicien</option>
<option value="electricien">electricien</option>
<option value="chauffeur">chauffeur</option>
</select></th>
</tr>
<tr>
<th scope="row"><label for="select2"></label>
<select name="provincie" id="select2">
<option value="alles" selected="selected">Kies Regio</option>
<option value="Oost-vlaanderen">Oost-Vlaanderen</option>
<option value="West-vlaanderen">West-Vlaanderen</option>
</select></th>
</tr>
<tr>
<th scope="row"><label for="select3"></label>
<select name="select3" id="select3">
<option>kies opleidingsniveau</option>
<option>A2</option>
<option>A3</option>
<option>PROF. Bachelor</option>
</select></th>
</tr>
<tr>
<th scope="row"><input type="submit" name="show" id="show" value="zoeken" /></th>
</tr>
</table>
</form>
</div>
<div class="wrappy">
<div class="spacer">Kandidaten overzicht</div>
<div class="resultcontainer">
<div class="onderresult"> </div>
</body>
</html>
<form id="form1" name="form1" method="post" action="" >
<input type="hidden" name="page" value="" />
<label for="select"></label>
<table width="200" border="0" align="left" cellpadding="5">
<tr>
<th scope="row"><select name="functie" id="select">
<option value="alles" selected="selected">Kies een functiegebied</option>
<option value="lasser">lasser</option>
<option value="mecanicien">Mecanicien</option>
<option value="electricien">electricien</option>
<option value="chauffeur">chauffeur</option>
</select></th>
</tr>
<tr>
<th scope="row"><label for="select2"></label>
<select name="provincie" id="select2">
<option value="alles" selected="selected">Kies Regio</option>
<option value="Oost-vlaanderen">Oost-Vlaanderen</option>
<option value="West-vlaanderen">West-Vlaanderen</option>
</select></th>
</tr>
<tr>
<th scope="row"><label for="select3"></label>
<select name="select3" id="select3">
<option>kies opleidingsniveau</option>
<option>A2</option>
<option>A3</option>
<option>PROF. Bachelor</option>
</select></th>
</tr>
<tr>
<th scope="row"><input type="submit" name="show" id="show" value="zoeken" /></th>
</tr>
</table>
</form>
</div>
<div class="wrappy">
<div class="spacer">Kandidaten overzicht</div>
<div class="resultcontainer">
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
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
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
<?php
$tableName="kandidatengoed";
$targetpage = "platform.php";
$limit = 10;
$query = "SELECT COUNT(*) as num FROM $tableName WHERE voorkeursfunctiegebied1='".$_POST['functie']."' AND provincie='" . $_POST['provincie'] . "'";
$total_pages = mysql_fetch_array(mysql_query($query));
$total_pages = $total_pages[num];
$stages = 3;
$page = 0;
if(isset($_GET['page']))
$page = intval($_GET['page']);
else if(isset($_POST['page']))
$page = intval($_POST['page']);
// Get page data
$query1 = "SELECT * FROM kandidatengoed WHERE voorkeursfunctiegebied1='".$_POST['functie']."' AND provincie='" . $_POST['provincie'] . "' LIMIT $start, $limit";
$result = mysql_query($query1);
// Initial page num setup
if ($page == 0){$page = 1;}
$prev = $page - 1;
$next = $page + 1;
$lastpage = ceil($total_pages/$limit);
$LastPagem1 = $lastpage - 1;
$paginate = '';
if($lastpage > 1)
{
$paginate .= "<div class='paginate'>";
// Previous
if ($page > 1){
$paginate.= "<a href='$targetpage?page=$prev'>previous</a>";
}else{
$paginate.= "<span class='disabled'>previous</span>"; }
// Pages
if ($lastpage < 7 + ($stages * 2)) // Not enough pages to breaking it up
{
for ($counter = 1; $counter <= $lastpage; $counter++)
{
if ($counter == $page){
$paginate.= "<span class='current'>$counter</span>";
}else{
$paginate.= "<a href='$targetpage?page=$counter'>$counter</a>";}
}
}
elseif($lastpage > 5 + ($stages * 2)) // Enough pages to hide a few?
{
// Beginning only hide later pages
if($page < 1 + ($stages * 2))
{
for ($counter = 1; $counter < 4 + ($stages * 2); $counter++)
{
if ($counter == $page){
$paginate.= "<span class='current'>$counter</span>";
}else{
$paginate.= "<a href='$targetpage?page=$counter'>$counter</a>";}
}
$paginate.= "...";
$paginate.= "<a href='$targetpage?page=$LastPagem1'>$LastPagem1</a>";
$paginate.= "<a href='$targetpage?page=$lastpage'>$lastpage</a>";
}
// Middle hide some front and some back
elseif($lastpage - ($stages * 2) > $page && $page > ($stages * 2))
{
$paginate.= "<a href='$targetpage?page=1'>1</a>";
$paginate.= "<a href='$targetpage?page=2'>2</a>";
$paginate.= "...";
for ($counter = $page - $stages; $counter <= $page + $stages; $counter++)
{
if ($counter == $page){
$paginate.= "<span class='current'>$counter</span>";
}else{
$paginate.= "<a href='$targetpage?page=$counter'>$counter</a>";}
}
$paginate.= "...";
$paginate.= "<a href='$targetpage?page=$LastPagem1'>$LastPagem1</a>";
$paginate.= "<a href='$targetpage?page=$lastpage'>$lastpage</a>";
}
// End only hide early pages
else
{
$paginate.= "<a href='$targetpage?page=1'>1</a>";
$paginate.= "<a href='$targetpage?page=2'>2</a>";
$paginate.= "...";
for ($counter = $lastpage - (2 + ($stages * 2)); $counter <= $lastpage; $counter++)
{
if ($counter == $page){
$paginate.= "<span class='current'>$counter</span>";
}else{
$paginate.= "<a href='$targetpage?page=$counter'>$counter</a>";}
}
}
}
// Next
if ($page < $counter - 1){
$paginate.= "<a href='$targetpage?page=$next'>next</a>";
}else{
$paginate.= "<span class='disabled'>next</span>";
}
$paginate.= "</div>";
}
?>
$tableName="kandidatengoed";
$targetpage = "platform.php";
$limit = 10;
$query = "SELECT COUNT(*) as num FROM $tableName WHERE voorkeursfunctiegebied1='".$_POST['functie']."' AND provincie='" . $_POST['provincie'] . "'";
$total_pages = mysql_fetch_array(mysql_query($query));
$total_pages = $total_pages[num];
$stages = 3;
$page = 0;
if(isset($_GET['page']))
$page = intval($_GET['page']);
else if(isset($_POST['page']))
$page = intval($_POST['page']);
// Get page data
$query1 = "SELECT * FROM kandidatengoed WHERE voorkeursfunctiegebied1='".$_POST['functie']."' AND provincie='" . $_POST['provincie'] . "' LIMIT $start, $limit";
$result = mysql_query($query1);
// Initial page num setup
if ($page == 0){$page = 1;}
$prev = $page - 1;
$next = $page + 1;
$lastpage = ceil($total_pages/$limit);
$LastPagem1 = $lastpage - 1;
$paginate = '';
if($lastpage > 1)
{
$paginate .= "<div class='paginate'>";
// Previous
if ($page > 1){
$paginate.= "<a href='$targetpage?page=$prev'>previous</a>";
}else{
$paginate.= "<span class='disabled'>previous</span>"; }
// Pages
if ($lastpage < 7 + ($stages * 2)) // Not enough pages to breaking it up
{
for ($counter = 1; $counter <= $lastpage; $counter++)
{
if ($counter == $page){
$paginate.= "<span class='current'>$counter</span>";
}else{
$paginate.= "<a href='$targetpage?page=$counter'>$counter</a>";}
}
}
elseif($lastpage > 5 + ($stages * 2)) // Enough pages to hide a few?
{
// Beginning only hide later pages
if($page < 1 + ($stages * 2))
{
for ($counter = 1; $counter < 4 + ($stages * 2); $counter++)
{
if ($counter == $page){
$paginate.= "<span class='current'>$counter</span>";
}else{
$paginate.= "<a href='$targetpage?page=$counter'>$counter</a>";}
}
$paginate.= "...";
$paginate.= "<a href='$targetpage?page=$LastPagem1'>$LastPagem1</a>";
$paginate.= "<a href='$targetpage?page=$lastpage'>$lastpage</a>";
}
// Middle hide some front and some back
elseif($lastpage - ($stages * 2) > $page && $page > ($stages * 2))
{
$paginate.= "<a href='$targetpage?page=1'>1</a>";
$paginate.= "<a href='$targetpage?page=2'>2</a>";
$paginate.= "...";
for ($counter = $page - $stages; $counter <= $page + $stages; $counter++)
{
if ($counter == $page){
$paginate.= "<span class='current'>$counter</span>";
}else{
$paginate.= "<a href='$targetpage?page=$counter'>$counter</a>";}
}
$paginate.= "...";
$paginate.= "<a href='$targetpage?page=$LastPagem1'>$LastPagem1</a>";
$paginate.= "<a href='$targetpage?page=$lastpage'>$lastpage</a>";
}
// End only hide early pages
else
{
$paginate.= "<a href='$targetpage?page=1'>1</a>";
$paginate.= "<a href='$targetpage?page=2'>2</a>";
$paginate.= "...";
for ($counter = $lastpage - (2 + ($stages * 2)); $counter <= $lastpage; $counter++)
{
if ($counter == $page){
$paginate.= "<span class='current'>$counter</span>";
}else{
$paginate.= "<a href='$targetpage?page=$counter'>$counter</a>";}
}
}
}
// Next
if ($page < $counter - 1){
$paginate.= "<a href='$targetpage?page=$next'>next</a>";
}else{
$paginate.= "<span class='disabled'>next</span>";
}
$paginate.= "</div>";
}
?>
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
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
<?php
echo "<table border='1' align='left' cellpadding='4' cellspacing='1' width='auto' bordercolor='#FFCC00'>
<tr>
<th>Voornaam</th>
<th>opleidingsniveau</th>
<th>provincie</th>
<th>Functiegebied</th>
<th>Ervaring</th>
<th>woonplaats</th>
</tr>";
while($row = mysql_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $row['voornaam'] . "</td>";
echo "<td>" . $row['opleidingsniveau'] . "</td>";
echo "<td>" . $row['provincie'] . "</td>";
echo "<td>" . $row['voorkeursfunctiegebied1'] . "</td>";
echo "<td>" . $row['ervaring'] . "</td>";
echo "<td>" . $row['woonplaats'] . "</td>";
echo "</tr>";
}
echo "</table>";
?>
echo "<table border='1' align='left' cellpadding='4' cellspacing='1' width='auto' bordercolor='#FFCC00'>
<tr>
<th>Voornaam</th>
<th>opleidingsniveau</th>
<th>provincie</th>
<th>Functiegebied</th>
<th>Ervaring</th>
<th>woonplaats</th>
</tr>";
while($row = mysql_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $row['voornaam'] . "</td>";
echo "<td>" . $row['opleidingsniveau'] . "</td>";
echo "<td>" . $row['provincie'] . "</td>";
echo "<td>" . $row['voorkeursfunctiegebied1'] . "</td>";
echo "<td>" . $row['ervaring'] . "</td>";
echo "<td>" . $row['woonplaats'] . "</td>";
echo "</tr>";
}
echo "</table>";
?>
Code (php)
<div class="onderresult"> </div>
</body>
</html>
Gewijzigd op 23/04/2013 00:51:02 door anthony de meulemeester
het is niet noodzakelijk om {} na een if te zetten , maar ik zou het wel doen.
de paginering werkt maar hij toont geen resultaten.
omdat ik van buiten weet hoeveel results hij heeft weet ik dat de paginering werkt. ik krijg geen results te zien en geen foutmeldingen. iemand die kan zien wat er fout is?
omdat ik van buiten weet hoeveel results hij heeft weet ik dat de paginering werkt. ik krijg geen results te zien en geen foutmeldingen. iemand die kan zien wat er fout is?




