[HULP] zoek form resultaten in content krijgen.

Overzicht Reageren

Sponsored by: Vacatures door Monsterboard

Danny@dw-designs.n

[email protected]

08/06/2008 19:40:00
Quote Anchor link
Hallo,

Ik heb een zoek forumulier waarbij de resultaten onder het forumulier komen wat ik niet wil.
( forumulier: http://www.gevelenkozijn.nl/ )
Zoek bijvoorbeeld op: danny

Nu zie je het resultaat onder de zoekbox, maar ik wil deze dus in het contentn krijgen:

index.php
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
<?php

 $url
= $_GET['pagina'];

 if ( $url == "" ) { $content = 'inc/danny.inc.php'; }

  elseif ( $url == "home" ) { $content = 'inc/danny.inc.php'; }

  elseif ( $url == "about" ) { $content = 'inc/about.inc.php'; }

  elseif ( $url == "contact" ) { $content = 'inc/contact.inc.php'; }

  elseif ( $url == "links" ) { $content = 'inc/links'. $_GET['id'] . '.inc.php'; }

  elseif ( $url == "faq" ) { $content = 'inc/faq.inc.php'; }

  elseif ( $url == "forum" ) { $content = 'inc/forum.inc.php'; }

  elseif ( $url == "gallery") { $content = 'inc/gallery'. $_GET['id'] . '.inc.php'; }
 
?>

......
.....
niet belangerijk
....
....
    <tr>
      <td rowspan="3"><img src="images/gek_26.jpg" width="1" height="332" alt=""></td>
      <td rowspan="2" valign="top" background="images/gek_27.jpg"><?php include('inc/zoeken.inc.php'); ?></td>
      <td><img src="images/spacer.gif" width="1" height="323" alt=""></td>
    </tr>


zoeken.inc.php
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
<?php
// Variabele voor de ingevoerde zoekterm:
$trefwoord = "";
// Variabele voor titel van de webpagina:
$paginatitel = "Zoeken";
// Variabele voor (fout)meldingen:
$melding = "<p>Typ een trefwoord in het invoervak en klik op de knop Zoeken.</p>";

// Ordernummer doorgeven als sessie-id (sid) in URL's:
if (isset($_GET['sid'])) {
    $url1 = "?sid=" . $_GET['sid'];
    $url2 = "" . $_GET['sid'];
}
else {
    $url1 = "";
    $url2 = "$trefwoord";
}


if (isset($_GET['search'])) {
    $trefwoord = $_GET['search'];             // Trefwoord uit het vak 'q'
    $trefwoord = strip_tags($trefwoord); // Tags en code verwijderen
    $trefwoord = trim($trefwoord);       // Witruimte verwijderen
    // Zoeken alleen starten als er een trefwoord is ingevoerd:

    if (strlen($trefwoord) > 1) {
        // MySQL-selectiequery met reguliere expressies:
        $sql  = 'SELECT `naam`, `email`, `wachtwoord`';
        $sql .= 'FROM `gebruikers` ';
        $sql .= 'WHERE `naam` REGEXP "' . $trefwoord . '" ';
        $sql .= 'OR `email` REGEXP "' . $trefwoord . '" ';
        $sql .= 'ORDER BY `naam` DESC ';
        // Databaseverbinding openen en query uitvoeren:
        define("MYSQL_SERVER", "localhost");
        $verbinding = mysql_connect(lGEHEIM) or die(mysql_error());
        mysql_select_db("gevelenkozijn_n") or die(mysql_error());
        $resultaat = mysql_query($sql) or die(mysql_error());
        // Is er een record gevonden?
        if (mysql_num_rows($resultaat) < 1) {
            mysql_free_result($resultaat); // Resultaatset vrijgeven
            mysql_close($verbinding);      // Databaseverbinding sluiten
            $melding = "<p>Er zijn geen resultaten gevonden voor " . $trefwoord . ".</p>";
        }
else {
            $paginatitel = "Zoekresultaten voor " . $trefwoord;
            $melding  = "<p>Er zijn ";
            $melding .= mysql_num_rows($resultaat);
            $melding .= " resultaten gevonden voor " . $trefwoord . ":</p>\n";
            // Begin van een genummerde opsomming:
            $melding .= "<ol>";
            // De gevonden producten toevoegen aan de melding:
            while ($rij = mysql_fetch_assoc($resultaat)) {
                $melding .= '<li><strong>';
                // Gebruikersnaam:
                $melding .= $rij["naam"];
                $melding .= $url2;
                $melding .= '';
                $melding .= '</strong><br>';
                // E-Mailadres van de user:
                $melding .= $rij["email"];
                $melding .= '<br>';
                //pass
                $melding .= $rij["wachtwoord"];
                $melding .= "</li>\n";
            }






            // Resultaatset vrijgeven en databaseverbinding sluiten:
            mysql_free_result($resultaat);
            mysql_close($verbinding);
            // Einde van de genummerde opsomming:
            $melding .= "</ol>\n";
            // Trefwoord opvallend markeren in de resultaten:
            $melding = eregi_replace($trefwoord, '<strong class="iv">' . $trefwoord . '</strong>', $melding);
        }
    }
}


?>

<form action="<?php echo $url1; ?>" method="get">
  &nbsp;Zoeken:<br />
  <table border="0" cellpadding="2" cellspacing="2">
    <tr>
      <td align="right"><input name="search" size="15" value="<?php echo $trefwoord; ?>"></td>
      <td align="left">
<?php
// Eventueel ordernummer doorgeven als verborgen formulierveld:
if (isset($_GET['sid'])) {
    echo '<input name="sid" type="hidden" value="' . $_GET['sid'] . '">';
}

?>
</td>
    </tr>
  </table>
  <input style="width: 75px; height: 23px;" type="submit" value="Zoeken" />
</form>
<?php
echo $melding;
?>
  
</body>
</html>


Ziet iemand het probleem, want ik heb alles all zo'n 30x geprobeerd, ben nu 6 uur bezig met het oplosen
Gewijzigd op 01/01/1970 01:00:00 door [email protected]
 
PHP hulp

PHP hulp

20/04/2024 10:25:50
 
Jesper Diovo

Jesper Diovo

08/06/2008 19:44:00
Quote Anchor link
Wat dacht je van de zoekresultaten ergens anders echo'en? Bijvoorbeeld in het content gedeelte?
 
Danny@dw-designs.n

[email protected]

08/06/2008 19:49:00
Quote Anchor link
Ik gebruik alleen maar .inc.php bestanden
en die echo't hij all met $content
Dus dan zou ik $content moeten verandere in $melding..

Waardoor ik de andere pagina's niet meer zie.

btw hier de index 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
175
176
177
<html>
<head>
<title>Gevel & Kozijn</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="_css/text.css" rel="stylesheet" type="text/css">
</head>
<body bgcolor="#776868" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<?php

    $tijd
= date("G");

    switch ($tijd){

        case
$tijd <= 6:

            $tekst = "Goedenacht!";

            break;

        case
$tijd <= 12:

            $tekst = "Goedemorgen!";

            break;

        case
$tijd <= 18:

            $tekst = "Goedemiddag!";

            break;

        case
$tijd <= 24:

            $tekst = "Goedenavond!";            

            break;

        default:


            $tekst = "Ik heb geen idee hoe laat het is...";

    }


?>

<?php

$time
= date(H .':' . i); //tijd

$date = date(j .' '. M .' '. Y); //datum

$ip = $_SERVER['REMOTE_ADDR']; // gebruiker zijn IP Adresss (niet in gebruik)

?>

<?php

 $url
= $_GET['pagina'];

 if ( $url == "" ) { $content = 'inc/danny.inc.php'; }

  elseif ( $url == "home" ) { $content = 'inc/danny.inc.php'; }

  elseif ( $url == "about" ) { $content = 'inc/about.inc.php'; }

  elseif ( $url == "contact" ) { $content = 'inc/contact.inc.php'; }

  elseif ( $url == "links" ) { $content = 'inc/links'. $_GET['id'] . '.inc.php'; }

  elseif ( $url == "faq" ) { $content = 'inc/faq.inc.php'; }

  elseif ( $url == "forum" ) { $content = 'inc/forum.inc.php'; }

  elseif ( $url == "gallery") { $content = 'inc/gallery'. $_GET['id'] . '.inc.php'; }
 
?>

<center>
  <table id="Table_01" width="801" height="669" border="0" cellpadding="0" cellspacing="0">
    <tr>
      <td colspan="15" valign="top" background="images/gek_01.jpg"></td>
      <td><img src="images/spacer.gif" width="1" height="17" alt=""></td>
    </tr>
    <tr>
      <td colspan="15"><img src="images/gek_02.jpg" width="800" height="105" alt=""></td>
      <td><img src="images/spacer.gif" width="1" height="105" alt=""></td>
    </tr>
    <tr>
      <td><img src="images/gek_03.jpg" width="1" height="2" alt=""></td>
      <td colspan="14"><img src="images/gek_04.jpg" width="799" height="2" alt=""></td>
      <td><img src="images/spacer.gif" width="1" height="2" alt=""></td>
    </tr>
    <tr>
      <td><img src="images/gek_05.jpg" width="1" height="14" alt=""></td>
      <td colspan="4"><a href="index.php?pagina=home"><img src="images/gek_06.jpg" width="158" height="14" alt=""></a></td>
      <td><img src="images/gek_07.jpg" width="2" height="14" alt=""></td>
      <td colspan="2"><a href="index.php?pagina=about"><img src="images/gek_08.jpg" width="158" height="14" alt=""></a></td>
      <td><img src="images/gek_09.jpg" width="2" height="14" alt=""></td>
      <td><a href="index.php?pagina=contact"><img src="images/gek_10.jpg" width="158" height="14" alt=""></a></td>
      <td><img src="images/gek_11.jpg" width="2" height="14" alt=""></td>
      <td><a href="index.php?pagina=forum"><img src="images/gek_12.jpg" width="158" height="14" alt=""></a></td>
      <td><img src="images/gek_13.jpg" width="2" height="14" alt=""></td>
      <td colspan="2"><a href="index.php?pagina=links"><img src="images/gek_14.jpg" width="159" height="14" alt=""></a></td>
      <td><img src="images/spacer.gif" width="1" height="14" alt=""></td>
    </tr>
    <tr>
      <td colspan="15"><img src="images/gek_15.jpg" width="800" height="10" alt=""></td>
      <td><img src="images/spacer.gif" width="1" height="10" alt=""></td>
    </tr>
    <tr>
      <td colspan="2" rowspan="9"><img src="images/gek_16.jpg" width="9" height="520" alt=""></td>
      <td colspan="2" rowspan="2"><img src="images/gek_17.jpg" width="148" height="17" alt=""></td>
      <td colspan="3" rowspan="8"><img src="images/gek_18.jpg" width="8" height="501" alt=""></td>
      <td colspan="7" valign="bottom" background="images/gek_19.jpg">&nbsp;<?php echo ("<strong>$tekst</strong>"); ?> Het is&nbsp;<?php echo $date .' '. $time ?></td>
      <td rowspan="9"><img src="images/gek_20.jpg" width="10" height="520" alt=""></td>
      <td><img src="images/spacer.gif" width="1" height="16" alt=""></td>
    </tr>
    <tr>
      <td colspan="7" rowspan="2"><img src="images/gek_21.jpg" width="625" height="13" alt=""></td>
      <td><img src="images/spacer.gif" width="1" height="1" alt=""></td>
    </tr>
    <tr>
      <td colspan="2"><img src="images/gek_22.jpg" width="148" height="12" alt=""></td>
      <td><img src="images/spacer.gif" width="1" height="12" alt=""></td>
    </tr>
    <tr>
      <td colspan="2" valign="top" background="images/gek_23.jpg">&nbsp;- <a href="index.php?pagina=home">Home</a><br>
        &nbsp;- <a href="index.php?pagina=about">Over ons</a><br>
        &nbsp;- <a href="index.php?pagina=contact">Contact</a><br>
        &nbsp;- <a href="index.php?pagina=links">Links</a><br>
        &nbsp;- <a href="index.php?pagina=gallery&id=1">Gallerij</a><br>
        &nbsp;- <a href="index.php?pagina=forum">Forum</a><br>
        &nbsp;- <a href="index.php?pagina=faq">F.A.Q.</a><br>
        <br></td>
      <td colspan="7" rowspan="3" valign="top" background="images/gek_24.jpg"><?php include($content);?></td>
      <td><img src="images/spacer.gif" width="1" height="127" alt=""></td>
    </tr>
    <tr>
      <td colspan="2"><img src="images/gek_25.jpg" width="148" height="13" alt=""></td>
      <td><img src="images/spacer.gif" width="1" height="13" alt=""></td>
    </tr>
    <tr>
      <td rowspan="3"><img src="images/gek_26.jpg" width="1" height="332" alt=""></td>
      <td rowspan="2" valign="top" background="images/gek_27.jpg"><?php include('inc/zoeken.inc.php'); ?></td>
      <td><img src="images/spacer.gif" width="1" height="323" alt=""></td>
    </tr>
    <tr>
      <td colspan="7" rowspan="2"><img src="images/gek_28.jpg" width="625" height="9" alt=""></td>
      <td><img src="images/spacer.gif" width="1" height="1" alt=""></td>
    </tr>
    <tr>
      <td><img src="images/gek_29.jpg" width="147" height="8" alt=""></td>
      <td><img src="images/spacer.gif" width="1" height="8" alt=""></td>
    </tr>
    <tr>
      <td colspan="12" valign="middle" background="images/gek_30.jpg"><div align="center"> &copy;Copyrights <a href="http://www.gevelenkozijn.nl/">Gevel en Kozijn</a> 2008-2009&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Webdesign &amp; Coding by: <a href="http:///www.dannywage.nl/">Danny Wage</a></div></td>
      <td><img src="images/spacer.gif" width="1" height="19" alt=""></td>
    </tr>
    <tr>
      <td><img src="images/spacer.gif" width="1" height="1" alt=""></td>
      <td><img src="images/spacer.gif" width="8" height="1" alt=""></td>
      <td><img src="images/spacer.gif" width="1" height="1" alt=""></td>
      <td><img src="images/spacer.gif" width="147" height="1" alt=""></td>
      <td><img src="images/spacer.gif" width="2" height="1" alt=""></td>
      <td><img src="images/spacer.gif" width="2" height="1" alt=""></td>
      <td><img src="images/spacer.gif" width="4" height="1" alt=""></td>
      <td><img src="images/spacer.gif" width="154" height="1" alt=""></td>
      <td><img src="images/spacer.gif" width="2" height="1" alt=""></td>
      <td><img src="images/spacer.gif" width="158" height="1" alt=""></td>
      <td><img src="images/spacer.gif" width="2" height="1" alt=""></td>
      <td><img src="images/spacer.gif" width="158" height="1" alt=""></td>
      <td><img src="images/spacer.gif" width="2" height="1" alt=""></td>
      <td><img src="images/spacer.gif" width="149" height="1" alt=""></td>
      <td><img src="images/spacer.gif" width="10" height="1" alt=""></td>
      <td></td>
    </tr>
  </table>
</center>
</body>
</html>
Gewijzigd op 01/01/1970 01:00:00 door [email protected]
 



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.