<?php
session_start();
include("header2.php");
include("conection.php");
include("modal.php");
$view = array_key_exists('view', $_GET);
if($view && $_GET['view'] == "delete")
{
mysql_query("DELETE FROM linkdetails WHERE linkid ='$_GET[linkid]'");
}
if(isset($_SESSION["adminusername"]))
{
$first = array_key_exists('first', $_GET);
if(isset($_GET['first']))
{
}
else
{
$last = array_key_exists('last', $_GET);
$_GET['first'] =0;
$_GET['last'] = 30;
}
if(isset($_POST["button"]))
{
$result = mysql_query("SELECT * FROM linkdetails where
ispid='.$_POST[ispid].' && typeid='.$_POST[typeid].'");
}
else
{
$result = mysql_query("SELECT * FROM linkdetails LIMIT $_GET[first] ,
$_GET[last]");
}
$resulti= mysql_query("SELECT * FROM ispdetails LIMIT $_GET[first] ,
$_GET[last]");
$resultt= mysql_query("SELECT * FROM linktype LIMIT $_GET[first] ,
$_GET[last]");?>
<section id="page">
<header id="pageheader" class="normalheader">
<h2 class="sitedescription">
</h2>
</header>
<section id="contents">
<article class="post">
<header class="postheader">
<h1>Link Details</h1>
<p>
<p>
<form method="post" action="">
<label for="textfield1"><strong>ISP Name </strong></label>
<strong>
<select name="ispid" id="select">
<option value=""> Select ISP</option>
<?php
while($row1 = mysql_fetch_array($resulti))
{
echo "<option value='$row1[ispid]'>$row1[ispname] </option>";
}
?>
</select>
<p>
<label for="textfield2"><strong>Link Type </strong></label>
<strong>
<select name="typeid" id="select">
<option value=""> Link Type </option>
<?php
while($row1 = mysql_fetch_array($resultt))
{
echo "<option value='$row1[typeid]'>$row1[typename]</option>";
}
?>
</select>
</strong>
<input type="submit" name="Submit" id="button" value="View Records"
onclick="submit" formaction="viewresult2.php"/>
</form>
</p>
</header>
<section class="entry">
</section>
<section class="entry">
</section>
<section class="entry">
</section>
<section class="entry">
<?php
if(mysql_num_rows($result) >= 1)
{
?>
<table width="500" border="1">
<tr>
<td width="56"><strong>Link Name</strong></td>
<td width="56"><strong>Area</strong></td>
<td width="136"><strong>Contact Details</strong></td>
<td width="56"><strong>Comments</strong></td>
<td width="56"><strong>Phone No</strong></td>
<td width="56"><strong>email</strong></td>
<td width="56"><strong>Remarks</strong></td>
<?php
if($_SESSION["type"]=="admin")
{
?>
<td width="119"><strong>Action</strong></td>
<?php
}
?>
</tr>
<?php
$i =$_GET['first']+1;
while($row = mysql_fetch_array($result))
{
echo "<tr>";
echo "<td> " . $row['linkname'] . "</td>";
echo "<td> " . $row['area'] . "</td>";
echo "<td> " . $row['contactdetails'] . "</td>";
echo "<td> " . $row['comments'] . "</td>";
echo "<td> " . $row['phone'] . "</td>";
echo "<td> " . $row['email'] . "</td>";
echo "<td> " . $row['remarks'] . "</td>";
if($_SESSION["type"] =="admin")
{
echo "<td>
<a href='viewrecords.php?linkid=$row[linkid]&view=linkdetails'><img
src='images/view.png' width='32' height='32' /></a>
<a href='addnewlink.php?linkid=$row[linkid]&view=linkdetails'> <img
src='images/edit.png' width='32' height='32' /></a>";
?>
<a href='linkmaster.php?linkid=$row[linkid]&view=delete'><img
src='images/delete.png' width='32' height='32' onclick="return confirm('Are
you sure??')"/></a></td>
<?php
}
echo "</tr> ";
$i++;
}
if($_SESSION["type"] =="admin")
{
$first=$_GET['first']-10;
$last= $_GET['last']- 10;
?>
<tr>
<td><?php
if($first <0)
{
}
else
{ ?>
<a href="linkmaster.php?first=<?php echo $first; ?>&last=<?php echo $last; ?
>">
<?php
}
?><img src="images/previous.png" alt="" width="32" height="32" /></td>
<td colspan="2"><a href="#" onclick="opennewlink(); return false"><img
src="images/add.png" alt="" width="32" height="32" /></a></td>
<?php
$first=$_GET['first']+10;
$last = $_GET['last']+ 10;
?>
<td><div align="right"><?php
if($first > mysql_num_rows($result))
{
}
else
{ ?>
<a href="linkmaster.php?first=<?php echo $first; ?>&last=<?php echo $last; ?
>">
<?php
}
?><img src="images/next.png" alt="" width="32" height="32" /></div></td>
<td width="119" align="right"> </td>
</tr>
<?php
}
?>
</table>
<?php
}
else
{
echo "<h2>No Records Found...</h2>";
}
?>
<ul>
<li><a href="addnewlink.php">Add New Link details</a></li>
</ul>
</section>
</article>
</section>
<?php
}
else
{
header("Location: adminlogin.php");
}
if($_SESSION["type"]=="admin")
{
include("adminmenu.php");
}
else
{
include("usermenu.php");
}
include("footer.php");
?>
Dropdown search is not working. When I am submitting the button it retrns without value. displaying the total value not the filtered value.
I think this is not working.
if(isset($_POST["button"]))
{
$result = mysql_query("SELECT * FROM linkdetails where
ispid='.$_POST[ispid].' && typeid='.$_POST[typeid].'");
Any Solution. Cause I'm not any professional developer.