473,322 Members | 1,736 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

candidate search, blanks page, problem...

127 100+
BElow is my php code for candidate search, it have 4 criteria which is academic background, functional experience, preferred location and languages ability. but it show yhe blanks page..
Emm, is it becase of the languages ability is at checkbox, so cannot display the profile...
Can someone give me a guildeline... Thanks..


[PHP]<?php
//required file for database connection
include("config.php");
if (isset($_POST['aBackground'])) {
$aBackground = mysql_real_escape_string($_POST["aBackground"]);
$fExperience = mysql_real_escape_string($_POST["fExperience"]);
$pLocation = $_POST["pLocation"];
$lAbility = $_POST["lAbility"];

$sql = "SELECT * FROM resume";

$string1 = array();
$where1 = "";
if (isset($_POST["aBackground"]) AND !empty($_POST["aBackground"]))
$string1[] = " aBackground LIKE '%".$_POST["aBackground"]."%' ";
if (isset($_POST["fExperience"]) AND !empty($_POST["fExperience"]))
$string1[] = " fExperience LIKE '%".$_POST["fExperience"]."%' ";
if (isset($_POST["pLocation"]) AND !empty($_POST["pLocation"]))
$string1[] = " pLocation LIKE '%".$_POST["pLocation"]."%' ";
if (isset($_POST["lAbility"]) AND !empty($_POST["lAbility"]))
$string1[] = " lAbility LIKE '%".$_POST["lAbility"]."%' ";
if (!empty($string1))
$where1 = " WHERE ".implode("AND", $string1);// OR/AND
$sql1="SELECT * FROM resume $where1";

$string2 = array();
$where2 = "";
if (isset($_POST["aBackground"]) AND !empty($_POST["aBackground"]))
$string2[] = " aBackground LIKE '%".$_POST["aBackground"]."%' ";
if (isset($_POST["fExperience"]) AND !empty($_POST["fExperience"]))
$string2[] = " fExperience LIKE '%".$_POST["fExperience"]."%' ";
if (isset($_POST["pLocation"]) AND !empty($_POST["pLocation"]))
$string2[] = " pLocation LIKE '%".$_POST["pLocation"]."%' ";
if (!empty($string2))
$where2 = " WHERE ".implode("AND", $string2);// OR/AND
$sql2="SELECT * FROM resume $where2";


$string3 = array();
$where3 = "";
if (isset($_POST["aBackground"]) AND !empty($_POST["aBackground"]))
$string3[] = " aBackground LIKE '%".$_POST["aBackground"]."%' ";
if (isset($_POST["fExperience"]) AND !empty($_POST["fExperience"]))
$string3[] = " fExperience LIKE '%".$_POST["fExperience"]."%' ";
if (isset($_POST["lAbility"]) AND !empty($_POST["lAbility"]))
$string3[] = " lAbility LIKE '%".$_POST["lAbility"]."%' ";
if (!empty($string3))
$where3 = " WHERE ".implode("AND", $string3);// OR/AND
$sql3="SELECT * FROM resume $where3";


$string4 = array();
$where4 = "";
if (isset($_POST["aBackground"]) AND !empty($_POST["aBackground"]))
$string4[] = " aBackground LIKE '%".$_POST["aBackground"]."%' ";
if (isset($_POST["pLocation"]) AND !empty($_POST["pLocation"]))
$string4[] = " pLocation LIKE '%".$_POST["pLocation"]."%' ";
if (isset($_POST["lAbility"]) AND !empty($_POST["lAbility"]))
$string4[] = " lAbility LIKE '%".$_POST["lAbility"]."%' ";
if (!empty($string4))
$where4 = " WHERE ".implode("AND", $string4);// OR/AND
$sql4="SELECT * FROM resume $where4";


$string5 = array();
$where5 = "";
if (isset($_POST["fExperience"]) AND !empty($_POST["fExperience"]))
$string5[] = " fExperience LIKE '%".$_POST["fExperience"]."%' ";
if (isset($_POST["pLocation"]) AND !empty($_POST["pLocation"]))
$string5[] = " pLocation LIKE '%".$_POST["pLocation"]."%' ";
if (isset($_POST["lAbility"]) AND !empty($_POST["lAbility"]))
$string5[] = " lAbility LIKE '%".$_POST["lAbility"]."%' ";
if (!empty($string5))
$where5 = " WHERE ".implode("AND", $string5);// OR/AND
$sql5="SELECT * FROM resume $where5";



// Call for this $sql
if ($aBackground== ""&&$fExperience==""&&$pLocation==""&&$lAbility="" ){
$data = mysql_query($sql)
or die("Cannot execute query");
}

elseif(!empty($aBackground)&&!empty($fExperience)& &!empty($pLocation)&&!empty($lAbility)){
$data = mysql_query($sql1)
or die("Cannot execute query");
}


elseif(!empty($aBackground)&&!empty($fExperience)& &!empty($pLocation)){
$data = mysql_query($sql2)
or die("Cannot execute query");
}


elseif(!empty($aBackground)&&!empty($fExperience)& &!empty($lAbility)){
$data = mysql_query($sql3)
or die("Cannot execute query");
}


elseif(!empty($aBackground)&&!empty($pLocation)&&! empty($lAbility)){
$data = mysql_query($sql4)
or die("Cannot execute query");
}


elseif(!empty($fExperience)&&!empty($pLocation)&&! empty($lAbility)){
$data = mysql_query($sql5)
or die("Cannot execute query");
}
?>


<?php
$anymatches = mysql_num_rows($data);
if ($anymatches == 0){

$message="&nbsp;&nbsp;<img src='image/sorry.gif'>".
"<font face='Verdana' size='2'>&nbsp;&nbsp;Sorry, your search returned 0 results.<br>";

include("candidateSearch.php");

exit();
}
?>

<?php
$bgcolor="#ccccff";
?>

<p align=center><center><font face='Verdana' size='3'><strong>Search Results</strong></p>
<table border='1'align=center>
<TABLE width=100% height="43" align=center cellpadding=0 cellspacing=0> <tr>
<td bgcolor='9999ff' >&nbsp;<font face='Verdana' color='#000000' size='3'>Resume ID</font></td>
<td bgcolor='9999ff' >&nbsp;<font face='Verdana' color='#000000' size='3'>Academic Background</font></td>
<td bgcolor='9999ff' >&nbsp;<font face='Verdana' color='#000000' size='3'>Functional Experience</font></td>
<td bgcolor='9999ff' >&nbsp;<font face='Verdana' color='#000000' size='3'>Preferred Location</font></td>
<td bgcolor='9999ff' >&nbsp;<font face='Verdana' color='#000000' size='3'>Languages Ability</font></td></tr>
</tr>


<?php
$counter = 0;
while($result = mysql_fetch_array( $data )){

if ($counter == 3) {

$counter = 0;
}


if($bgcolor=='#ccccff'){$bgcolor='#ffffff';}
else{$bgcolor='#ccccff';}

echo"
<tr><td align=left bgcolor=$bgcolor><a href='candidateSearch_result.php?id={$result['resume_ID']}'>&nbsp;<font face='Verdana' size='2'>{$result['resume_ID']}</a></td>
<td align=left bgcolor=$bgcolor>&nbsp;<font face='Verdana' size='2'>{$result['aBackground']}</td>
<td align=left bgcolor=$bgcolor>&nbsp;<font face='Verdana' size='2'>{$result['fExperience']}</td>
<td align=left bgcolor=$bgcolor>&nbsp;<font face='Verdana' size='2'>{$result['pLocation']}</td>
<td align=left bgcolor=$bgcolor>&nbsp;&nbsp;&nbsp;&nbsp;<font face='Verdana' size='2'>{$result['lAbility']}</td>
</tr>";

$counter = $counter + 1;
}
?>

</table>
<br><br><br><a href='candidateSearch.php? '><font face='Verdana' size='2'>Search again!!</a>


<?
}
?>[/PHP]
Mar 3 '07 #1
4 1318
bb nicole
127 100+
I try to edit the code, is already can work...
But still got bug, when i click in the langeanges ability(it is a check box, not list menu, can use the search code as list menu???), it can show any thing and remain in the same page, althrough the data is in the databse...
Could somebody give me a guildeline??
Below is part of my code(for language ability)
Expand|Select|Wrap|Line Numbers
  1.  <tr bgcolor="#A2ABEC"> 
  2.       <td colspan="2"><p align=left><font color="#000000" size="2" face="Verdana">&nbsp;&nbsp;Languages 
  3.           Ability</font></p></td>
  4.     </tr>
  5.     <tr bgcolor="#A2ABEC"> 
  6.       <td height="31"><p align="left">
  7.           <input type="checkbox" name="lAbility" value="english">
  8.           English 
  9.           <input type="checkbox" name="lAbility" value="malay">
  10.           Malay 
  11.           <input type="checkbox" name="lAbility" value="mandarin">
  12.           Mandarin 
  13.           <input type="checkbox" name="lAbility" value="indian">
  14.           Indian </p></td>
  15.       <td></tr>
[PHP]<?php
include("config.php");
if (isset($_POST['aBackground'])) {
$aBackground = mysql_real_escape_string($_POST["aBackground"]);
$fExperience = mysql_real_escape_string($_POST["fExperience"]);
$pLocation = $_POST["pLocation"];
$lAbility = $_POST["lAbility"]
$string1 = array();
$where1 = "";
if (isset($_POST["aBackground"]) AND !empty($_POST["aBackground"]))
$string1[] = " aBackground LIKE '%".$_POST["aBackground"]."%' ";
if (isset($_POST["fExperience"]) AND !empty($_POST["fExperience"]))
$string1[] = " fExperience LIKE '%".$_POST["fExperience"]."%' ";
if (isset($_POST["pLocation"]) AND !empty($_POST["pLocation"]))
$string1[] = " pLocation LIKE '%".$_POST["pLocation"]."%' ";
if (isset($_POST["lAbility"]) AND !empty($_POST["lAbility"]))
$string1[] = " lAbility LIKE '%".$_POST["lAbility"]."%' ";
if (!empty($string1))
$where1 = " WHERE ".implode("AND", $string1);// OR/AND
$sql1="SELECT * FROM resume $where1";
if(!empty($aBackground)&&!empty($fExperience)&&!em pty($pLocation)&&!empty($lAbility)){
$data = mysql_query($sql1)
or die("Cannot execute query");
} [/PHP]
Mar 4 '07 #2
bb nicole
127 100+
i have do a search engine which it search from drop down menu and check box..
im facing problem when using check box as 1 of my search criteria, after i remove it, it can work well..
Can someone give me some guilde??
IS IT DIFFERENT TO CODE THE SEARCH ENGINE FOR DROP DOWN MENU AND CHECK BOX??
HOW SHOULD I CODE FOR THE CHECK BOX ??
Thanks..
Mar 5 '07 #3
ronverdonk
4,258 Expert 4TB
Look at the following sample that gets and echoes the content of the checkbox. Caveat: in your code you give each checkbox an identical name. That means that, when someone clicks more than 1 box, you will only get the last one checked in your POST variable! That works like a radio button as far as POST value is concerned.

[php]
<?php
if (isset($_POST['submit'])) {
echo $_POST['lAbility'];
exit;
}
?>
<form method="POST" action="a.php">
<input type="checkbox" name="lAbility" value="english">English
<input type="checkbox" name="lAbility" value="malay">Malay
<input type="checkbox" name="lAbility" value="mandarin">Mandarin
<input type="checkbox" name="lAbility" value="indian">Indian
<input type="submit" name="submit" value="Search" />
</form>[/php]
Ronald :cool:
Mar 5 '07 #4
bb nicole
127 100+
Look at the following sample that gets and echoes the content of the checkbox. Caveat: in your code you give each checkbox an identical name. That means that, when someone clicks more than 1 box, you will only get the last one checked in your POST variable! That works like a radio button as far as POST value is concerned.

[php]
<?php
if (isset($_POST['submit'])) {
echo $_POST['lAbility'];
exit;
}
?>
<form method="POST" action="a.php">
<input type="checkbox" name="lAbility" value="english">English
<input type="checkbox" name="lAbility" value="malay">Malay
<input type="checkbox" name="lAbility" value="mandarin">Mandarin
<input type="checkbox" name="lAbility" value="indian">Indian
<input type="submit" name="submit" value="Search" />
</form>[/php]
Ronald :cool:

I know it will only get the last one checked in POST variable, but i don't know how to change it... I don't want it act like radio button, wat should i change in the code so it can function like checkbox..
And it is same using the code above for search engine in the matter of check box??
Thanks..
Mar 6 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: William Kossack | last post by:
I have an Access table with one primary key and am attempting to update a non-key field, using UPDATE tblMethtest SET fev1timemeth = '' WHERE SID = '0041R'; When I do this, the field...
32
by: tshad | last post by:
Can you do a search for more that one string in another string? Something like: someString.IndexOf("something1","something2","something3",0) or would you have to do something like: if...
0
by: Anthony Baxter | last post by:
On behalf of the Python development team and the Python community, I'm happy to announce the first RELEASE CANDIDATE of Python 2.5. This is not yet the final release - it is not suitable for...
4
by: Anthony Baxter | last post by:
On behalf of the Python development team and the Python community, I'm happy to announce the second RELEASE CANDIDATE of Python 2.5. After the first release candidate a number of new bugfixes...
34
by: Registered User | last post by:
Hi experts, I'm trying to write a program that replaces two or more consecutive blanks in a string by a single blank. Here's what I did: #include <stdio.h> #include <string.h> #define MAX 80
0
by: Anthony Baxter | last post by:
On behalf of the Python development team and the Python community, I'm announcing the release of Python 2.3.6 (release candidate 1). Python 2.3.6 is a security bug-fix release. While Python 2.5...
6
by: MLH | last post by:
I'm sure its a bozo question, but it's got me stumped. How do I search for a question mark in an open table using CTRL-F to launch the search in the current field. The field is a text field. Not...
10
by: Diego F. | last post by:
Hi all. I have an application that receives a message from a socket in an array from a certain size. As the array size may be longer that the message received, the end of the array has blank...
5
by: kai2589 | last post by:
Hi, First, thanks in advance to those who is willing to help me. Second, I'm a total noob at C++ programming, so the code i'm posting might be completely wrong nd needs to be redone. Anyways,...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.