Code: Select all
andCode: Select all
tags where approriate when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]
Hi...I'm working on a website http://searchbanks.com/search.php...on that page you will see 12-13 different checkboxes where a user can mark a check in the checkbox and search that various category... the code for that I will attach after my question.
My problem is I'm having a difficult time converting those checkbox options to text links instead. So for example instead of having the user search by putting a check in the check box I want a link that says "Lending" where the user can just click on the link and have the same results as what they had with the check box.
How would I go about this? A sample code would be excellent.
Here is the current code with the check box. FYI the results are being pulled from a database.Code: Select all
<?php
require "xxx.php";
require "xxx.php";
$hugeres = SQLact("query", "SELECT * FROM freelancers_bans WHERE ip='" . $REMOTE_ADDR . "'");
$hugerows = SQLact("num_rows", $hugeres);
if ($hugerows==0) {
include ("header.php");
if ($showstatus == "open") {
?>
<b><big>Project Search Results</big></b><br><small>
Status: open<br>
</small>
<p>
<table width="100%" border="<? echo $tableborder; ?>" cellspacing="<? echo $tablecellsp; ?>" cellpadding="<? echo $tablecellpa; ?>">
<tr>
<td bgcolor="<? echo $tablecolorh; ?>" width=150><b><font color=<? echo $tablecolort; ?>>Project Name</td>
<td bgcolor="<? echo $tablecolorh; ?>"><b><font color=<? echo $tablecolort; ?>>Job Type</td>
<td bgcolor="<? echo $tablecolorh; ?>"><b><font color=<? echo $tablecolort; ?>>Bids</td>
<td bgcolor="<? echo $tablecolorh; ?>"><b><font color=<? echo $tablecolort; ?>>Status</td>
<td bgcolor="<? echo $tablecolorh; ?>"><b><font color=<? echo $tablecolort; ?>>Start Date</td>
</tr>
<?php
$result = SQLact("query", "SELECT * FROM freelancers_projects WHERE status='open' ORDER BY date2 DESC");
$rows = SQLact("num_rows", $result);
if ($rows==0) {
echo '<tr>
<td bgcolor="' . $tablecolor1 . '" colspan="5" align="center">(No open projects found.)</td>
</tr>';
} else {
while ($row=SQLact("fetch_array", $result)) {
?>
<tr>
<td bgcolor="<? echo $tablecolor1; ?>"><a href="<? echo $siteurl; ?>/project.php?id=<? echo $row[id]; ?>"><? echo $row[project]; ?></a><?
if ($row[special] == "featured") {
echo ' <a href="' . $siteurl . '/featured.php"><img src="' . $siteurl . '/images/featured.gif" alt="Featured Project!" border=0></a>';
} else {}
$secondsPerDay9 = ((24 * 60) * 60);
$timeStamp9 = time();
$daysUntilExpiry9 = $row[expires];
$getdat9 = $timeStamp9 + ($daysUntilExpiry9 * $secondsPerDay9);
$thedat9 = $getdat9-$timeStamp9;
$realdat9 = round($thedat9/((24 * 60) * 60));
$explod9 = explode('-', $projectudays);
for ($i9=0;$i9<count($explod9);$i9++) {
if ($realdat9==$explod9[$i9]) {
echo ' <img src="' . $siteurl . '/images/urgent.gif" alt="Urgent!" border=0>';
}
}
?></td>
<td bgcolor="<? echo $tablecolor1; ?>"><?php
$archway = $row[categories];
$len=strlen($archway);
$boink=substr("$archway", 0, ($len-2));
echo $boink;
?></td>
<td bgcolor="<? echo $tablecolor1; ?>"><?
$result2 = SQLact("query", "SELECT * FROM freelancers_bids WHERE id='" . $row[id] . "'");
$rows2 = SQLact("num_rows", $result2);
echo $rows2;
?></td>
<td bgcolor="<? echo $tablecolor1; ?>"><font color=green><b>open</td>
<td bgcolor="<? echo $tablecolor1; ?>"><? echo $row[creation]; ?></td>
</tr>
<?php
}
}
?>
</table>
<small><? echo $rows; ?> project<?
if ($rows!==1) {
echo 's';
} else {}
?> found.</small><p>
<small><a href="<? echo $siteurl; ?>/search.php">Perform Another Search...</a></small><p>
<?php
} else {
if (!$submit) {
?>
<center>
<big><b>Search Projects</b></big>
<p>
<form method="POST" action="search.php">
<div align="center"><center>
<b>Status:</b>
<select name="status" size="1">
<option selected value="">Any</option>
<option value="open">Open</option>
<option value="frozen">Frozen</option>
<option value="closed">Closed</option>
</select>
<input type="submit" value="Search" name="submit">
<p>
<b>Keywords:</b> <input type="text" name="keywords" value="" size="20">
<p>
<table>
<tr><td>
<b>Job Type:</b><br>
<?php
$selectcats = SQLact("query", "SELECT * FROM freelancers_cats");
$i=0;
while ($row=SQLact("fetch_array", $selectcats)) {
$i++;
?>
<input type="checkbox" name="category[]" value="<? echo $row[categories]; ?>"> <? echo $row[categories]; ?><br>
<?php
}
?>
</td></tr>
</table>
</center></div>
</form>
<?php
} else {
if (is_array($category)) {
$query = "SELECT * FROM freelancers_projects WHERE categories LIKE '";
foreach ($category as $key=>$val) {
$query .= "%" . $val . "%";
}
$query .= "' AND ";
} else {
$query = "SELECT * FROM freelancers_projects WHERE ";
}
if ($status == "") {
$query .= "project LIKE '%$keywords%' ORDER BY date2 DESC";
} else {
$query .= "status LIKE '$status' AND project LIKE '%$keywords%' ORDER BY date2 DESC";
}
$lolres = SQLact("query", $query);
$rows = SQLact("num_rows", $lolres);
?>
<b><big>Project Search Results</big></b><br><small>
Status: <?
if ($status == "") {
echo "all";
} else {
echo $status;
}
?><br>
</small>
<p>
<table width="100%" border="<? echo $tableborder; ?>" cellspacing="<? echo $tablecellsp; ?>" cellpadding="<? echo $tablecellpa; ?>">
<tr>
<td bgcolor="<? echo $tablecolorh; ?>" width=150><b><font color=<? echo $tablecolort; ?>>Project Name</td>
<td bgcolor="<? echo $tablecolorh; ?>"><b><font color=<? echo $tablecolort; ?>>Job Type</td>
<td bgcolor="<? echo $tablecolorh; ?>"><b><font color=<? echo $tablecolort; ?>>Bids</td>
<td bgcolor="<? echo $tablecolorh; ?>"><b><font color=<? echo $tablecolort; ?>>Status</td>
<td bgcolor="<? echo $tablecolorh; ?>"><b><font color=<? echo $tablecolort; ?>>Start Date</td>
</tr>
<?php
if ($rows!==0) {
while ($row=SQLact("fetch_array", $lolres)) {
?>
<tr>
<td bgcolor="<? echo $tablecolor1; ?>"><a href="<? echo $siteurl; ?>/project.php?id=<? echo $row[id]; ?>"><? echo $row[project]; ?></a><?
if ($row[special] == "featured") {
echo ' <a href="' . $siteurl . '/featured.php"><img src="' . $siteurl . '/images/featured.gif" alt="Featured Project!" border=0>';
} else {}
$secondsPerDay9 = ((24 * 60) * 60);
$timeStamp9 = time();
$daysUntilExpiry9 = $row[expires];
$getdat9 = $timeStamp9 + ($daysUntilExpiry9 * $secondsPerDay9);
$thedat9 = $getdat9-$timeStamp9;
$realdat9 = round($thedat9/((24 * 60) * 60));
$explod9 = explode('-', $projectudays);
for ($i9=0;$i9<count($explod9);$i9++) {
if ($realdat9==$explod9[$i9]) {
echo ' <img src="' . $siteurl . '/images/urgent.gif" alt="Urgent!" border=0>';
}
}
?></a></td>
<td bgcolor="<? echo $tablecolor1; ?>"><?php
$archway = $row[categories];
$len=strlen($archway);
$boink=substr("$archway", 0, ($len-2));
echo $boink;
?></td>
<td bgcolor="<? echo $tablecolor1; ?>"><?
$y4res = SQLact("query", "SELECT * FROM freelancers_bids WHERE id='" . $row[id] . "'");
echo SQLact("num_rows", $y4res);
?></td>
<td bgcolor="<? echo $tablecolor1; ?>"><?
if ($row[status] == "open") {
echo '<font color="green"><b>' . $row[status] . '</font>';
} else if ($row[status] == "frozen") {
echo '<font color="blue"><b>' . $row[status] . '</font>';
} else {
echo '<font color="red"><b>closed</font>';
}?></td>
<td bgcolor="<? echo $tablecolor1; ?>"><? echo $row[creation]; ?></td>
</tr>
<?php
}
} else {
echo '<tr>
<td bgcolor="' . $tablecolor1 . '" colspan="5" align="center">(No projects found.)</td>
</tr>';
}
?>
</table>
<small><? echo $rows; ?> project<?
if ($rows!==1) {
echo 's';
} else {}
?> found.</small><p>
<small><a href="<? echo $siteurl; ?>/search.php">Perform Another Search...</a></small><p>
<?php
}
}
include ("footer.php");
} else {
echo 'You have been banned from using ' . $companyname . '!<br>
You do not have access to any services used in this section of the website!<br>
The reason for your ban is:<br>
<b><i>';
$humanres = SQLact("query", "SELECT * FROM freelancers_bans WHERE ip='" . $REMOTE_ADDR . "'");
$rrreason = SQLact("result", $humanres,0,"reason");
if ($rrreason == "") {
echo 'No reason was given for your ban.';
} else {
echo $rrreason;
}
echo '</i></b><br><br>
If you think there has been a mistake, contact ' . $emailaddress;
}
?>Code: Select all
andCode: Select all
tags where approriate when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]