Ja, zoiets, alleen wil ik dat net als bij bijvoorbeeld sommige forums waar smiley's uit een extern smiley venster in de tekst op de andere pagina geplakt worden, dus zonder te herladen een waarde invoegen zegmaar.
Hier de hele code van het zoekgedeelte. Let er niet op hoe netjes het is, ik heb nog niet zoveel PHP ervaring
PHP:
<html>
<head>
<title>Search</title>
<link href="../themes/eticket/style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<?PHP
//ensure no caching by browser - START
@header('Expires: '.gmdate('D, d M Y H:i:s T',0)); //A Date in the past
@header('Last-Modified: '.gmdate('D, d M Y H:i:s T')); // always modified
@header('Cache-Control: private'); // make private
@header("Cache-Control: no-store, no-cache, must-revalidate"); // no cache for HTTP/1.1
@header("Cache-Control: post-check=0, pre-check=0", false); // no cache for HTTP/1.1
@header("Pragma: no-cache"); // no cache for HTTP/1.0
//ensure no caching by browser - END
require_once('../settings.php');
require_once('../init.php');
if ($_SESSION['user']['type'] == 'admin') {
if (isset($_POST['search'])) {
echo "<script>window.resizeTo(800, 400)</script>";
$color1 = "tablebody2";
$color2 = "tablebody";
$row_count = 0;
$result = mysql_query("SELECT * FROM ticket_devices
WHERE id LIKE '%$_POST[searchid]%'
AND merk LIKE '%$_POST[searchmerk]%'
AND type LIKE '%$_POST[searchtype]%'
AND locatie LIKE '%$_POST[searchlocatie]%'
") or die(mysql_error());
if (mysql_num_rows($result) < 1) {
echo "<script>window.resizeTo(200, 125);</script>";
echo "<h2>Niks gevonden!</h2><table width=100%><tr><td align=left>
<a href=searchdevice.php><img src=../themes/eticket/images/arrowbw.gif border=0><i>Terug</i></a></td></tr></table>";
}else{
echo "<table align=center class=tablehead width=98%>";
echo "<tr><td class=tablehead width=20%>ID:";
echo "</td><td class=tablehead width=20%>Merk:";
echo "</td><td class=tablehead width=20%>Type:";
echo "</td><td class=tablehead width=20%>Locatie:";
echo "</td><td class=tablehead width=20%>Selecteren:</table>";
while($row = mysql_fetch_assoc($result))
{
$row_color = ($row_count % 2) ? $color1 : $color2;
echo "<table class=$row_color align=center class=tablebody width=98%>";
echo "<tr><td width=20%>".$row['id'];
echo "</td><td width=20%>".$row['merk'];
echo "</td><td width=20%>".$row['type'];
echo "</td><td width=20%>".$row['locatie'];
?>
</td><td width=20%><form action="../newticket.php" method="post">
<input type="hidden" name="deviceid" value=<?=$row['id']?>>
<input class="inputsubmit" type="submit" name="toevoegen" value="Toevoegen">
<?
echo "</td></tr></table>";
$row_count++;
}
}
}
else{
?>
<script>
window.resizeTo(400, 200);
</script>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<!-- Header -->
<table class="tablehead" width="98%" align="center"><tr><td align="center" class="tablehead">Zoeken:</table></td></tr>
<!-- Device ID -->
<table class="tablebody" width="98%" align="center"><tr><td width="25%"><b>Device ID:</b></td><td width="100%" align="center">
<input type="text" name="searchid" id="searchid" size="31"></td></tr></table>
<!-- Merk -->
<table class="tablebody2" width="98%" align="center"><tr><td width="25%"><b>Merk:</b></td><td width="100%" align="center">
<input type="text" name="searchmerk" id="searchmerk" size="31"></td></tr></table>
<!-- Type -->
<table class="tablebody" width="98%" align="center"><tr><td width="25%"><b>Type:</b></td><td width="100%" align="center">
<input type="text" name="searchtype" id="searchtype" size="31"></td></tr></table>
<!-- Locatie -->
<table class="tablebody2" width="98%" align="center"><tr><td width="25%"><b>Locatie:</b></td><td width="100%" align="center">
<input type="text" name="searchlocatie" id="searchlocatie" size="31"></td></tr></table>
<!-- Zoeken -->
<table width="89.5%"><tr>
<td align="right">
<input class="inputsubmit" type="submit" name="search" id="search" title="<?=LANG_TIP_ZOEKEN;?>"value="<?=LANG_ZOEKEN;?>">
</form>
<?PHP
}
}
else {echo "<h2>U bent niet gemachtigd om deze pagina te bekijken</h2>";}
?>
</body>
</html>
En de pagina waar het in moet:
PHP:
$name_html = '<input type="text" name="name" id="name" size="25" value="'.htmlspecialchars($_POST['name']).'">';
$device_html = '<input type="text" name="device" id="device" size="5" value="'.htmlspecialchars($_POST['deviceid']).'">';
$email_html = '<input type="text" name="email" id="email" size="25" value="'.htmlspecialchars($_POST['email']).'">';
HTML:
<tr>
<td align="left"><?=LANG_DEVICE?>:</td>
<td><?=$device_html?> <a href="inc/searchdevice.php" onclick="window.open(this.href, 'popupwindow', ',noscrollbars,noresize'); return false;">Search</a></td>
</tr>