Code:
<form method="get" action="trazi_korisnika.php">
<table border="0" width="427">
<tr>
<td width="142">
Korisničko ime: </td>
<td width="166"><input type="text" name="ime" value="<?php echo $_GET[ime];?>"/></td>
<td width="105"><input name="submit" type="submit" id="submit" value="Trazi" /></td>
</tr>
<tr>
</table>
</form>
<form method="get" action="trazi_korisnika.php">
<table border="0" width="427">
<tr>
<td width="142">
Korisničko ime: </td>
<td width="166"><input type="text" name="ime" value="<?php echo $_GET[ime];?>"/></td>
<td width="105"><input name="submit" type="submit" id="submit" value="Trazi" /></td>
</tr>
<tr>
</table>
</form>
trazi_korisnika.php:
Code:
<?php
if ($_GET){
$ime=$_GET[ime];
$rs=db_query("SELECT korisnik, ime, prezime, email, vrsta FROM korisnik
WHERE ime LIKE '%$ime%'");
if ($rs){
while(list($korisnik, $ime, $prezime, $email, $vrsta)=mysql_fetch_array($rs)){
echo "$ime<br/>";
}
}
}
?>
<?php
if ($_GET){
$ime=$_GET[ime];
$rs=db_query("SELECT korisnik, ime, prezime, email, vrsta FROM korisnik
WHERE ime LIKE '%$ime%'");
if ($rs){
while(list($korisnik, $ime, $prezime, $email, $vrsta)=mysql_fetch_array($rs)){
echo "$ime<br/>";
}
}
}
?>
To radi ok, a sad sam pokušao napraviti da tražilica ima na izboru prema čemu hoče da pretraživa, ali sam stao, tj. ne znam dalje. Napravio sam sljedeće zasad, FORMA:
Code:
<form method="get" action="trazi_korisnika.php">
<table border="0" width="427">
<tr>
<td width="142">
<select>
<option >Pretraga prema:</option>
<option name="ime" value="<?php echo $_GET[ime];?>">Ime</a></option>
<option name="prezime" value="<?php echo $_GET[prezime];?>">Prezime</a></option>
<option name="email" value="<?php echo $_GET[email];?>">Email</a></option>
</select></td>
<td width="166"><input type="text" name=select value="<?php echo $_GET[ime];?>"/>
</td>
<td width="105">
//tu znam da treba izmjeniti ali ne znam kako!?!
<input name="submit" type="submit" id="submit" value="Trazi" />
</td>
</tr>
<tr>
</table>
</form>
<form method="get" action="trazi_korisnika.php">
<table border="0" width="427">
<tr>
<td width="142">
<select>
<option >Pretraga prema:</option>
<option name="ime" value="<?php echo $_GET[ime];?>">Ime</a></option>
<option name="prezime" value="<?php echo $_GET[prezime];?>">Prezime</a></option>
<option name="email" value="<?php echo $_GET[email];?>">Email</a></option>
</select></td>
<td width="166"><input type="text" name=select value="<?php echo $_GET[ime];?>"/>
</td>
<td width="105">
//tu znam da treba izmjeniti ali ne znam kako!?!
<input name="submit" type="submit" id="submit" value="Trazi" />
</td>
</tr>
<tr>
</table>
</form>
trazi_korisnika.php
Code:
<?php
if (logiran() && $_SESSION[korisnik][vrsta]==0){ ?>
<?php
if ($_GET){
$ime=$_GET[ime];
$prezime=$_GET[prezime];
$email=$_GET[email];
$rs=db_query("SELECT korisnik, ime, prezime, email FROM korisnik
WHERE ime LIKE '%$ime%' AND prezime LIKE '%$prezime%' AND email LIKE '%$email%'");
if ($rs){
while(list($korisnik, $ime, $prezime, $email, $vrsta)=mysql_fetch_array($rs)){
echo "$ime<br/>";
}
}
}
}
?>
<?php
if (logiran() && $_SESSION[korisnik][vrsta]==0){ ?>
<?php
if ($_GET){
$ime=$_GET[ime];
$prezime=$_GET[prezime];
$email=$_GET[email];
$rs=db_query("SELECT korisnik, ime, prezime, email FROM korisnik
WHERE ime LIKE '%$ime%' AND prezime LIKE '%$prezime%' AND email LIKE '%$email%'");
if ($rs){
while(list($korisnik, $ime, $prezime, $email, $vrsta)=mysql_fetch_array($rs)){
echo "$ime<br/>";
}
}
}
}
?>
Molim za pomoč!