473,800 Members | 2,414 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

candidate search, blanks page, problem...

127 New Member
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_esca pe_string($_POS T["aBackgroun d"]);
$fExperience = mysql_real_esca pe_string($_POS T["fExperienc e"]);
$pLocation = $_POST["pLocation"];
$lAbility = $_POST["lAbility"];

$sql = "SELECT * FROM resume";

$string1 = array();
$where1 = "";
if (isset($_POST["aBackgroun d"]) AND !empty($_POST["aBackgroun d"]))
$string1[] = " aBackground LIKE '%".$_POST["aBackgroun d"]."%' ";
if (isset($_POST["fExperienc e"]) AND !empty($_POST["fExperienc e"]))
$string1[] = " fExperience LIKE '%".$_POST["fExperienc e"]."%' ";
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($string 1))
$where1 = " WHERE ".implode("AND" , $string1);// OR/AND
$sql1="SELECT * FROM resume $where1";

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


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


$string4 = array();
$where4 = "";
if (isset($_POST["aBackgroun d"]) AND !empty($_POST["aBackgroun d"]))
$string4[] = " aBackground LIKE '%".$_POST["aBackgroun d"]."%' ";
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($string 4))
$where4 = " WHERE ".implode("AND" , $string4);// OR/AND
$sql4="SELECT * FROM resume $where4";


$string5 = array();
$where5 = "";
if (isset($_POST["fExperienc e"]) AND !empty($_POST["fExperienc e"]))
$string5[] = " fExperience LIKE '%".$_POST["fExperienc e"]."%' ";
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($string 5))
$where5 = " WHERE ".implode("AND" , $string5);// OR/AND
$sql5="SELECT * FROM resume $where5";



// Call for this $sql
if ($aBackground== ""&&$fExperienc e==""&&$pLocati on==""&&$lAbili ty=""){
$data = mysql_query($sq l)
or die("Cannot execute query");
}

elseif(!empty($ aBackground)&&! empty($fExperie nce)&&!empty($p Location)&&!emp ty($lAbility)){
$data = mysql_query($sq l1)
or die("Cannot execute query");
}


elseif(!empty($ aBackground)&&! empty($fExperie nce)&&!empty($p Location)){
$data = mysql_query($sq l2)
or die("Cannot execute query");
}


elseif(!empty($ aBackground)&&! empty($fExperie nce)&&!empty($l Ability)){
$data = mysql_query($sq l3)
or die("Cannot execute query");
}


elseif(!empty($ aBackground)&&! empty($pLocatio n)&&!empty($lAb ility)){
$data = mysql_query($sq l4)
or die("Cannot execute query");
}


elseif(!empty($ fExperience)&&! empty($pLocatio n)&&!empty($lAb ility)){
$data = mysql_query($sq l5)
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("candid ateSearch.php") ;

exit();
}
?>

<?php
$bgcolor="#cccc ff";
?>

<p align=center><c enter><font face='Verdana' size='3'><stron g>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'>Academ ic Background</font></td>
<td bgcolor='9999ff ' >&nbsp;<font face='Verdana' color='#000000' size='3'>Functi onal Experience</font></td>
<td bgcolor='9999ff ' >&nbsp;<font face='Verdana' color='#000000' size='3'>Prefer red Location</font></td>
<td bgcolor='9999ff ' >&nbsp;<font face='Verdana' color='#000000' size='3'>Langua ges Ability</font></td></tr>
</tr>


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

if ($counter == 3) {

$counter = 0;
}


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

echo"
<tr><td align=left bgcolor=$bgcolo r><a href='candidate Search_result.p hp?id={$result['resume_ID']}'>&nbsp;<font face='Verdana' size='2'>{$resu lt['resume_ID']}</a></td>
<td align=left bgcolor=$bgcolo r>&nbsp;<font face='Verdana' size='2'>{$resu lt['aBackground']}</td>
<td align=left bgcolor=$bgcolo r>&nbsp;<font face='Verdana' size='2'>{$resu lt['fExperience']}</td>
<td align=left bgcolor=$bgcolo r>&nbsp;<font face='Verdana' size='2'>{$resu lt['pLocation']}</td>
<td align=left bgcolor=$bgcolo r>&nbsp;&nbsp;& nbsp;&nbsp;<fon t face='Verdana' size='2'>{$resu lt['lAbility']}</td>
</tr>";

$counter = $counter + 1;
}
?>

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


<?
}
?>[/PHP]
Mar 3 '07 #1
4 1340
bb nicole
127 New Member
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_esca pe_string($_POS T["aBackgroun d"]);
$fExperience = mysql_real_esca pe_string($_POS T["fExperienc e"]);
$pLocation = $_POST["pLocation"];
$lAbility = $_POST["lAbility"]
$string1 = array();
$where1 = "";
if (isset($_POST["aBackgroun d"]) AND !empty($_POST["aBackgroun d"]))
$string1[] = " aBackground LIKE '%".$_POST["aBackgroun d"]."%' ";
if (isset($_POST["fExperienc e"]) AND !empty($_POST["fExperienc e"]))
$string1[] = " fExperience LIKE '%".$_POST["fExperienc e"]."%' ";
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($string 1))
$where1 = " WHERE ".implode("AND" , $string1);// OR/AND
$sql1="SELECT * FROM resume $where1";
if(!empty($aBac kground)&&!empt y($fExperience) &&!empty($pLoca tion)&&!empty($ lAbility)){
$data = mysql_query($sq l1)
or die("Cannot execute query");
} [/PHP]
Mar 4 '07 #2
bb nicole
127 New Member
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 Recognized Expert Specialist
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">M alay
<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 New Member
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">M alay
<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
1656
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 subsequently contains 5 blanks instead of the zero-length string I tried to put into it. This problem occurs regardless of whether I execute the SQL from within Cold Fusion or from within Access as an Access query. The same problem occurs on any non-key...
32
14905
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 ((someString.IndexOf("something1",0) >= 0) || ((someString.IndexOf("something2",0) >= 0) ||
0
1348
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 production use. It is being released to solicit feedback and hopefully expose bugs, as well as allowing you to determine how changes in 2.5 might impact you. As a release candidate, this is one of your last chances to test the new code in 2.5...
4
2717
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 have been applied to the Python 2.5 code. In the interests of making 2.5 the best release possible, we've decided to put out a second (and hopefully last) release candidate. We plan for a 2.5 final in a week's time.
34
4118
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
1212
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 is the latest version of Python, we're making this release for people who are still running Python 2.3. Unlike the recently released 2.4.4, this release only contains a small handful of security-related bugfixes. See the website for more.
6
2675
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 all records have a "?" in the field, but some do. The search process treats the question-mark as a wildcard character and finds the occurrence in EVERY record. Hmmm??? Is there no way to specify a Chr$(63)
10
2819
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 characters. I use the System.Text.Encoding.ASCII.GetString method to convert to string and insert in a database. The problem is that in the database the blanks are inserted as well. How can I remove the blanks before inserting in the database?
5
6209
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, here's the problem i'm faced with, word for word from the C++ book: A data file called votelist contains a list of candidates voted for by each student. Any line of the file may contains 5 numbers, with each number representing a candidate. Write a...
0
9551
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10505
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10253
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9085
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5471
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5606
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4149
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3764
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2945
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.