Hi,
This is Ashok from India as I am a student but currently having a training for web development so I made a Job Consultancy Project and face the following problems....
1. i designed a form on which user can input the information about the candidates and a search will apply for lists the desired data by the form.

but I'm unable to apply the search script.

So will you please help me out of this problem by giving a script file of any reference for my problem's solution.

My search terms are Name,Mobile,Email,Experience,CTC and etc its a multiple search term.


I shall be thankful to you all.

Ashok
<EMAIL SNIPPED>

Hey.

We can't really help you fix the problem unless we can see your code. There is no copy/paste'able script for stuff like this we can just hand over. It has to be tailored to your data.

Also, a description of your database tables would be helpful.

ok man i'm sending you my table details
plz help me out

This is my Tabled Structure
`candidates` (
`id` varchar(10) NOT NULL,
`name` varchar(30) NOT NULL,
`mob1` varchar(15) NOT NULL,
`mob2` varchar(15) NOT NULL,
`landline` varchar(15) NOT NULL,
`email` varchar(30) NOT NULL,
`address` varchar(30) NOT NULL,
`city` varchar(20) NOT NULL,
`state` varchar(20) NOT NULL,
`desig` varchar(35) NOT NULL,
`org` varchar(35) NOT NULL,
`wloc` varchar(35) NOT NULL,
`exp` varchar(5) NOT NULL,
`ctc` varchar(5) NOT NULL,
`convert` varchar(10) NOT NULL,
`regdate` date NOT NULL,
`regpack` varchar(10) NOT NULL,
`conslt` varchar(20) NOT NULL,
`interv` varchar(2) NOT NULL,
`choice` varchar(35) NOT NULL,
`status` varchar(10) NOT NULL,
`comment` varchar(50) NOT NULL,
PRIMARY KEY (`id`)


I apply the search criteria on the columns name,mob1,mob2,email,exp,ctc,city,wloc,conslt,regdate and regpack

I want a php script file which search all the similar data which is to be entered into the search form

I have already made a search form and its code is as follows....

<style type="text/css">
<!--
.style1 {	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 36px;
}
.style2 {	color: #CCCCCC;
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 14px;
}
.style3 {font-size: 16px}
-->
</style>

<form action="search.php" method="post">
<table width="60%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td width="2%" bgcolor="#000000">&nbsp;</td>
    <td width="96%" bgcolor="#000000">&nbsp;</td>
    <td width="2%" bgcolor="#000000">&nbsp;</td>
  </tr>
  <tr>
    <td bgcolor="#000000">&nbsp;</td>
    <td bgcolor="#CCCCCC"><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td><div align="center" class="style1">Versatile Solutions</div></td>
      </tr>
      <tr>
        <td bgcolor="#000000"><div align="center" class="style2 style3">Search For A Candidate</div></td>
      </tr>
      <tr>
        <td><div align="center">
          <table width="75%" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td width="3%">&nbsp;</td>
              <td width="21%">&nbsp;</td>
              <td width="2%">&nbsp;</td>
              <td width="24%">&nbsp;</td>
              <td width="1%">&nbsp;</td>
              <td width="24%">&nbsp;</td>
              <td width="2%">&nbsp;</td>
              <td width="20%">&nbsp;</td>
              <td width="3%">&nbsp;</td>
            </tr>
            <tr>
              <td>&nbsp;</td>
              <td align="right" valign="middle">Name</td>
              <td>&nbsp;</td>
              <td align="left" valign="middle"><input name="nam" type="text" /></td>
              <td>&nbsp;</td>
              <td align="right" valign="middle">Mobile 1</td>
              <td>&nbsp;</td>
              <td><input name="mob1" type="text" /></td>
              <td>&nbsp;</td>
            </tr>
            <tr>
              <td>&nbsp;</td>
              <td align="right" valign="middle">&nbsp;</td>
              <td>&nbsp;</td>
              <td>&nbsp;</td>
              <td>&nbsp;</td>
              <td align="right" valign="middle">&nbsp;</td>
              <td>&nbsp;</td>
              <td>&nbsp;</td>
              <td>&nbsp;</td>
            </tr>
            <tr>
              <td>&nbsp;</td>
              <td align="right" valign="middle">City</td>
              <td>&nbsp;</td>
              <td><input name="city" type="text" /></td>
              <td>&nbsp;</td>
              <td align="right" valign="middle">Mobile 2</td>
              <td>&nbsp;</td>
              <td><input name="mob2" type="text" /></td>
              <td>&nbsp;</td>
            </tr>
            <tr>
              <td>&nbsp;</td>
              <td align="right" valign="middle">&nbsp;</td>
              <td>&nbsp;</td>
              <td>&nbsp;</td>
              <td>&nbsp;</td>
              <td align="right" valign="middle">&nbsp;</td>
              <td>&nbsp;</td>
              <td>&nbsp;</td>
              <td>&nbsp;</td>
            </tr>
            <tr>
              <td>&nbsp;</td>
              <td align="right" valign="middle">Experience</td>
              <td>&nbsp;</td>
              <td><input name="exp" type="text"></td>
              <td>&nbsp;</td>
              <td align="right" valign="middle">CTC</td>
              <td>&nbsp;</td>
              <td><input name="ctc" type="text" /></td>
              <td>&nbsp;</td>
            </tr>
            <tr>
              <td>&nbsp;</td>
              <td align="right" valign="middle">&nbsp;</td>
              <td>&nbsp;</td>
              <td>&nbsp;</td>
              <td>&nbsp;</td>
              <td align="right" valign="middle">&nbsp;</td>
              <td>&nbsp;</td>
              <td>&nbsp;</td>
              <td>&nbsp;</td>
            </tr>
            <tr>
              <td>&nbsp;</td>
              <td align="right" valign="middle">Consultant</td>
              <td>&nbsp;</td>
              <td><input name="conslt" type="text" /></td>
              <td>&nbsp;</td>
              <td align="right" valign="middle">Resitration Pack</td>
              <td>&nbsp;</td>
              <td><input name="regpack" type="text" /></td>
              <td>&nbsp;</td>
            </tr>
            <tr>
              <td>&nbsp;</td>
              <td align="right" valign="middle">&nbsp;</td>
              <td>&nbsp;</td>
              <td>&nbsp;</td>
              <td>&nbsp;</td>
              <td align="right" valign="middle">&nbsp;</td>
              <td>&nbsp;</td>
              <td>&nbsp;</td>
              <td>&nbsp;</td>
            </tr>
            <tr>
              <td>&nbsp;</td>
              <td align="right" valign="middle">Condidate Choice</td>
              <td>&nbsp;</td>
              <td><input name="condcho" type="text" /></td>
              <td>&nbsp;</td>
              <td align="right" valign="middle">Registration Date</td>
              <td>&nbsp;</td>
              <td><input name="regdate" type="text" /></td>
              <td>&nbsp;</td>
            </tr>
            <tr>
              <td>&nbsp;</td>
              <td align="right">&nbsp;</td>
              <td align="right">&nbsp;</td>
              <td align="right">&nbsp;</td>
              <td align="right">&nbsp;</td>
              <td align="right">&nbsp;</td>
              <td align="right">&nbsp;</td>
              <td align="right">&nbsp;</td>
              <td>&nbsp;</td>
            </tr>
            <tr>
              <td>&nbsp;</td>
              <td align="right">Emil Address</td>
              <td align="right">&nbsp;</td>
              <td align="right">&nbsp;</td>
              <td align="right">&nbsp;</td>
              <td align="right">&nbsp;</td>
              <td align="right">&nbsp;</td>
              <td align="right">&nbsp;</td>
              <td>&nbsp;</td>
            </tr>
            <tr>
              <td>&nbsp;</td>
              <td>&nbsp;</td>
              <td>&nbsp;</td>
              <td colspan="3" align="center"><input type="submit" value="Search" />
                &nbsp;</td>
              <td>&nbsp;</td>
              <td>&nbsp;</td>
              <td>&nbsp;</td>
            </tr>
          </table>
          <p>&nbsp;</p>
        </div></td>
      </tr>
    </table></td>
    <td bgcolor="#000000">&nbsp;</td>
  </tr>
  <tr>
    <td bgcolor="#000000">&nbsp;</td>
    <td bgcolor="#000000">&nbsp;</td>
    <td bgcolor="#000000">&nbsp;</td>
  </tr>
</table>

</form>

and the script file name is search.php

so please send me a desired php script
I shall be very thankful to you.

There is no PHP code in there.
Where is the code that actually does the search?

I need that man
I dont have any php code
you should understand.

Please make a php script for me.

I'm happy to help you write the code, but I am not going to do it for you. This is your project and I am only here to help. You are going to have to do the heavy-lifting.

Have you even tried to do this yourself?
If so, what happened? What went wrong?

Tell me the problem and I will try to point you in the right direction, but I am not your code-monkey ;-)

I managed to piece together a simple script that will display the names of each person in the result. However the database design is not how I would design it but the following script will do the job with only a few fields not being active.

<?php
if ($_POST['submit']=='Search') {
    mysql_connect('localhost','root','');
    mysql_select_db('mydatabase');
    $where ='';
    $where.=(!empty($_POST['nam']))?', `name`="'.mysql_real_escape_string($_POST['nam']).'"':'';
    $where.=(!empty($_POST['mob1']))?', `mob1`="'.mysql_real_escape_string($_POST['mob1']).'"':'';
    $where.=(!empty($_POST['mob2']))?', `mob2`="'.mysql_real_escape_string($_POST['mob2']).'"':'';
    $where.=(!empty($_POST['exp']))?', `exp`="'.mysql_real_escape_string($_POST['exp']).'"':'';
    $where.=(!empty($_POST['ctc']))?', `ctc`="'.mysql_real_escape_string($_POST['ctc']).'"':'';
    $where.=(!empty($_POST['conslt']))?', `conslt`="'.mysql_real_escape_string($_POST['conslt']).'"':'';
    $where.=(!empty($_POST['regpack']))?', `regpack`="'.mysql_real_escape_string($_POST['regpack']).'"':'';
    if (!empty($where)) {
        $where=substr($where,2);
        $r=mysql_query('SELECT * FROM `candidates` WHERE '.$where);
        while($row=mysql_fetch_assoc($r)) {
            echo $row['name'].'<br>';
            }
        }
    }
?><style type="text/css">
<!--
.style1 { font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 36px;
}
.style2 { color: #CCCCCC;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 14px;
}
.style3 {font-size: 16px}
-->
</style>

<form action="search.php" method="post">
<table width="60%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="2%" bgcolor="#000000">&nbsp;</td>
<td width="96%" bgcolor="#000000">&nbsp;</td>
<td width="2%" bgcolor="#000000">&nbsp;</td>
</tr>
<tr>
<td bgcolor="#000000">&nbsp;</td>
<td bgcolor="#CCCCCC"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><div align="center" class="style1">Versatile Solutions</div></td>
</tr>
<tr>
<td bgcolor="#000000"><div align="center" class="style2 style3">Search For A Candidate</div></td>
</tr>
<tr>
<td><div align="center">
<table width="75%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="3%">&nbsp;</td>
<td width="21%">&nbsp;</td>
<td width="2%">&nbsp;</td>
<td width="24%">&nbsp;</td>
<td width="1%">&nbsp;</td>
<td width="24%">&nbsp;</td>
<td width="2%">&nbsp;</td>
<td width="20%">&nbsp;</td>
<td width="3%">&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td align="right" valign="middle">Name</td>
<td>&nbsp;</td>
<td align="left" valign="middle"><input name="nam" type="text" /></td>
<td>&nbsp;</td>
<td align="right" valign="middle">Mobile 1</td>
<td>&nbsp;</td>
<td><input name="mob1" type="text" /></td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td align="right" valign="middle">&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td align="right" valign="middle">&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td align="right" valign="middle">City</td>
<td>&nbsp;</td>
<td><input name="city" type="text" /></td>
<td>&nbsp;</td>
<td align="right" valign="middle">Mobile 2</td>
<td>&nbsp;</td>
<td><input name="mob2" type="text" /></td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td align="right" valign="middle">&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td align="right" valign="middle">&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td align="right" valign="middle">Experience</td>
<td>&nbsp;</td>
<td><input name="exp" type="text"></td>
<td>&nbsp;</td>
<td align="right" valign="middle">CTC</td>
<td>&nbsp;</td>
<td><input name="ctc" type="text" /></td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td align="right" valign="middle">&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td align="right" valign="middle">&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td align="right" valign="middle">Consultant</td>
<td>&nbsp;</td>
<td><input name="conslt" type="text" /></td>
<td>&nbsp;</td>
<td align="right" valign="middle">Resitration Pack</td>
<td>&nbsp;</td>
<td><input name="regpack" type="text" /></td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td align="right" valign="middle">&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td align="right" valign="middle">&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td align="right" valign="middle">Condidate Choice</td>
<td>&nbsp;</td>
<td><input name="condcho" type="text" /></td>
<td>&nbsp;</td>
<td align="right" valign="middle">Registration Date</td>
<td>&nbsp;</td>
<td><input name="regdate" type="text" /></td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td align="right">&nbsp;</td>
<td align="right">&nbsp;</td>
<td align="right">&nbsp;</td>
<td align="right">&nbsp;</td>
<td align="right">&nbsp;</td>
<td align="right">&nbsp;</td>
<td align="right">&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td align="right">Emil Address</td>
<td align="right">&nbsp;</td>
<td align="right">&nbsp;</td>
<td align="right">&nbsp;</td>
<td align="right">&nbsp;</td>
<td align="right">&nbsp;</td>
<td align="right">&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td colspan="3" align="center"><input type="submit" name="submit" value="Search" />
&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
</table>
<p>&nbsp;</p>
</div></td>
</tr>
</table></td>
<td bgcolor="#000000">&nbsp;</td>
</tr>
<tr>
<td bgcolor="#000000">&nbsp;</td>
<td bgcolor="#000000">&nbsp;</td>
<td bgcolor="#000000">&nbsp;</td>
</tr>
</table>

</form>

I haven't tested the above code for any bugs but hopefully it works.

My Search Script not search for multiple parameter
A single parameter search is done successfully but when I want to refine my search it not working

My Search Script as follows

if ($_POST['submit']=='Search'){
    mysql_connect('localhost','root','');
    mysql_select_db('versatile');
    $where ='';
    $where.=(!empty($_POST['nam']))?', `name`="'.mysql_real_escape_string($_POST['nam']).'"':'';
    $where.=(!empty($_POST['mob1']))?', `mob1`="'.mysql_real_escape_string($_POST['mob1']).'"':'';
    $where.=(!empty($_POST['qua']))?', `qua`="'.mysql_real_escape_string($_POST['qua']).'"':'';
    $where.=(!empty($_POST['exp']))?', `exp`="'.mysql_real_escape_string($_POST['exp']).'"':'';
    $where.=(!empty($_POST['ctc']))?', `ctc`="'.mysql_real_escape_string($_POST['ctc']).'"':'';
    $where.=(!empty($_POST['conslt']))?', `conslt`="'.mysql_real_escape_string($_POST['conslt']).'"':'';
    $where.=(!empty($_POST['regpack']))?', `regpack`="'.mysql_real_escape_string($_POST['regpack']).'"':'';
    $where.=(!empty($_POST['choice']))?', `choice`="'.mysql_real_escape_string($_POST['choice']).'"':'';
    $where.=(!empty($_POST['lob']))?', `lob`="'.mysql_real_escape_string($_POST['lob']).'"':'';
    $where.=(!empty($_POST['city']))?', `city`="'.mysql_real_escape_string($_POST['city']).'"':'';
    $where.=(!empty($_POST['email']))?', `email`="'.mysql_real_escape_string($_POST['email']).'"':'';
    if (!empty($where)) {
        $where=substr($where,2);
        $r=mysql_query('SELECT * FROM `candidates` WHERE '.$where);
        echo '<table border="\1"\ align=center bordercolor=white>';
        echo '<tr bgcolor=gray>';
        echo '<th>Name</td>';
        echo '<th>Qualification</td>';
        echo '<th>Mobile1</td>';
        echo '<th>Mobile2</td>';
        echo '<th>Landline</td>';
        echo '<th>Email</td>';
        echo '<th>Address</td>';
        echo '<th>City</td>';
        echo '<th>State</td>';
        echo '<th>Designation</td>';
        echo '<th>Present Org</td>';
        echo '<th>Work Loc</td>';
        echo '<th>Experience</td>';
        echo '<th>CTC</td>';
        echo '<th>Conversion</td>';
        echo '<th>Reg-Date</td>';
        echo '<th>Reg-Pack</td>';
        echo '<th>Consultant</td>';
        echo '<th>Interviews</td>';
        echo '<th>Choice</td>';
        echo '<th>Status</td>';
        echo '<th>Comments</td>';
        echo '</tr>';
        while($row=mysql_fetch_assoc($r)) {
            echo '<tr align=center>';
             echo '<td>'.$row['name'].'</td>';
             echo '<td>'.$row['qua'].'</td>';
             echo '<td>'.$row['mob1'].'</td>';
             echo '<td>'.$row['mob2'].'</td>';
             echo '<td>'.$row['landline'].'</td>';
             echo '<td>'.$row['email'].'</td>';
             echo '<td>'.$row['address'].'</td>';
             echo '<td>'.$row['city'].'</td>';
             echo '<td>'.$row['state'].'</td>';
             echo '<td>'.$row['desig'].'</td>';
             echo '<td>'.$row['org'].'</td>';
             echo '<td>'.$row['wloc'].'</td>';
             echo '<td>'.$row['exp'].'</td>';
             echo '<td>'.$row['ctc'].'</td>';
             echo '<td>'.$row['convert'].'</td>';
             echo '<td>'.$row['regdate'].'</td>';
             echo '<td>'.$row['regpack'].'</td>';
             echo '<td>'.$row['conslt'].'</td>';
             echo '<td>'.$row['interv'].'</td>';
             echo '<td>'.$row['choice'].'</td>';
             echo '<td>'.$row['status'].'</td>';
             echo '<td>'.$row['comment'].'</td>';
            }
        }
    }
    echo '</tr>';
    echo '</table>';
?>

Please help me modify my Search View

How can I get the data into the formatted table ?

Please Help me!

My Search Script not search for multiple parameter
A single parameter search is done successfully but when I want to refine my search it not working

My Search Script as follows

if ($_POST=='Search'){
mysql_connect('localhost','root','');
mysql_select_db('versatile');
$where ='';
$where.=(!empty($_POST))?', `name`="'.mysql_real_escape_string($_POST).'"':'';
$where.=(!empty($_POST))?', `mob1`="'.mysql_real_escape_string($_POST).'"':'';
$where.=(!empty($_POST))?', `qua`="'.mysql_real_escape_string($_POST).'"':'';
$where.=(!empty($_POST))?', `exp`="'.mysql_real_escape_string($_POST).'"':'';
$where.=(!empty($_POST))?', `ctc`="'.mysql_real_escape_string($_POST).'"':'';
$where.=(!empty($_POST))?', `conslt`="'.mysql_real_escape_string($_POST).'"':'';
$where.=(!empty($_POST))?', `regpack`="'.mysql_real_escape_string($_POST).'"':'';
$where.=(!empty($_POST))?', `choice`="'.mysql_real_escape_string($_POST).'"':'';
$where.=(!empty($_POST))?', `lob`="'.mysql_real_escape_string($_POST).'"':'';
$where.=(!empty($_POST))?', `city`="'.mysql_real_escape_string($_POST).'"':'';
$where.=(!empty($_POST))?', `email`="'.mysql_real_escape_string($_POST).'"':'';
if (!empty($where)) {
$where=substr($where,2);
$r=mysql_query('SELECT * FROM `candidates` WHERE '.$where);
echo '<table border="\1"\ align=center bordercolor=white>';
echo '<tr bgcolor=gray>';
echo '<th>Name</td>';
echo '<th>Qualification</td>';
echo '<th>Mobile1</td>';
echo '<th>Mobile2</td>';
echo '<th>Landline</td>';
echo '<th>Email</td>';
echo '<th>Address</td>';
echo '<th>City</td>';
echo '<th>State</td>';
echo '<th>Designation</td>';
echo '<th>Present Org</td>';
echo '<th>Work Loc</td>';
echo '<th>Experience</td>';
echo '<th>CTC</td>';
echo '<th>Conversion</td>';
echo '<th>Reg-Date</td>';
echo '<th>Reg-Pack</td>';
echo '<th>Consultant</td>';
echo '<th>Interviews</td>';
echo '<th>Choice</td>';
echo '<th>Status</td>';
echo '<th>Comments</td>';
echo '</tr>';
while($row=mysql_fetch_assoc($r)) {
echo '<tr align=center>';
echo '<td>'.$row.'</td>';
echo '<td>'.$row.'</td>';
echo '<td>'.$row.'</td>';
echo '<td>'.$row.'</td>';
echo '<td>'.$row.'</td>';
echo '<td>'.$row.'</td>';
echo '<td>'.$row.'</td>';
echo '<td>'.$row.'</td>';
echo '<td>'.$row.'</td>';
echo '<td>'.$row.'</td>';
echo '<td>'.$row.'</td>';
echo '<td>'.$row.'</td>';
echo '<td>'.$row.'</td>';
echo '<td>'.$row.'</td>';
echo '<td>'.$row.'</td>';
echo '<td>'.$row.'</td>';
echo '<td>'.$row.'</td>';
echo '<td>'.$row.'</td>';
echo '<td>'.$row.'</td>';
echo '<td>'.$row.'</td>';
echo '<td>'.$row.'</td>';
echo '<td>'.$row.'</td>';
}
}
}
echo '</tr>';
echo '</table>';
?>


Please help me modify my Search View

How can I get the data into the formatted table ?

Please Help me!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.