0

I have 2 search forms. One is linked to my local db of records and the other one links through an API to another db.

I want to now when my db does not have the required record, have it use the second search form without the user needing to insert the data again.

Is this possible and how do I go about merging the two?

Thanks for all the help guys.

Combination of form functions:

<div class="article">
      <h2>    
      <br> 
      SEARCH A REFERENCE
      <br> 
       </h2>
    </center>

    <body>
    <div id="formsearch">
    <br> 
       <form method="post" action="" name="form1" id="form1" >   

     Enter the  ID Number 
     <br><br>
     <b>Search Record  </b> <input type="text" name="term" /><br />
     <br>
    <input type="submit" name="submit" value="Search" class="btn" />
    </form>
    </div>
    <h3> <center> Search Result (s) </h3> 
 <?php

if ($_REQUEST['submit']) {

$term = $_POST['term'];

$row ['employerid'] == $user_data ['user_id'];
$XX = "<br><br><div class='messagebox'><h2> <center> Oops! </h2> <p>We were only to retrieve a partial record on <strong>$term</strong>  you have entered. Please make use of our contact form if you would like us to get you your reference. Be sure to enter the three required fields.  <a href='Mailforms/refrequest.php'  class='lightbox'>Click Here!</a> or to validate the id <a href='idverification.php'> Click here</a></p>
<br />
</div>";  
$sql = mysql_query("SELECT idnumber,
firstname,
lastname,
companyname,
jobtitle,
dismissal,
terminationdate,
startdate,
CONCAT(TIMESTAMPDIFF(YEAR,startdate,terminationdate), ' years and ', 
MOD(TIMESTAMPDIFF(MONTH,startdate,terminationdate),12), ' months ') AS time_diff
FROM ref_employees
WHERE idnumber= '$term'")
   or die('Error in query : $sql. ' .mysql_error());


if (mysql_num_rows($sql) > 0  )  {
while ($row = mysql_fetch_array($sql)){
    if ($row ['employed'] == '1') {
    echo '<h4>Currently Employed By :   '.$row['companyname'];
    echo '</h4> ';
    echo '<a href="#">Any doubts? Enquire about this candidate</a> ';
    }

    if ($row ['employed'] == '0') {
        echo ' <h4>Some Available Options For:</h4>';
        include 'includes/admenu.php';
    echo '<h4>Not Currently employed    '.$row['companyname'];
    echo '</h4> ';

    }

     echo "<table border='1' cellpadding='10'>";
        echo "<tr> <th>ID Number</th> <th>First Name</th> <th>Last Name</th><th>company</th> <th>Job Title</th> <th>Period</th><th>Reason for dismissal</th><th></th><th></th></tr>";
   echo "<tr>";
             echo '<td>' . $row['idnumber'] . '</td>';
echo '<td>' . $row['firstname'] . '</td>';
echo '<td>' . $row['lastname'] . '</td>';
echo '<td>' . $row['companyname'] . '</td>';
echo '<td>' . $row['jobtitle'] . '</td>';
echo '<td>' .($row['startdate'] + $row['terminationdate']).'</td>';
echo '<td>' . $row['dismissal'] . '</td>';
                echo '<td><a href="editemp.php?idnumber=' . $row['idnumber'] . '">Achievements</a></td>';
                echo '<td><a href="delete.php?idnumber=' . $row['idnumber'] . '">training</a></td>';
                echo "</tr>"; 
        } 

        // close table>
        echo "</table>";



}
}
else
 {
$id_number = $_POST['term'];

$authenticate = authentication();

$login_message = $authenticate['error_code'];
$session_id = $authenticate['session_id'];


$id_verification = verify_id($session_id, $id_number);
}


if (!empty($id_verification)){
echo '<br/>';
echo '<h3>Search Information</h3>';
echo 'Time Stamp: ';
echo $id_verification['TIME_STAMP'];
echo 'SOAP Result: ';
echo $id_verification['LOGIN-MESSAGE'];
echo ' ';
echo $id_verification['SEARCH-MESSAGE'];
echo ' ';
echo $id_verification['SEARCH-RESULT'];
echo '<br/>';
echo '<h3>Data: </h3>';
echo '<br/>ID Number: ';
echo $id_verification['IDNUMBER'];
echo '<br/>First Names: ';
echo $id_verification['FIRSTNAMES'];
echo '<br/>Last Name: ';
echo $id_verification['SURNAME'];

echo '<br/>Birthday: ';
echo $id_verification['BIRTHDAY'];
echo '<br/>Age: ';
echo $id_verification['AGE'];
echo '<br/>Gender: ';
echo $id_verification['GENDER'];
echo '<br/>Citizen: ';
echo $id_verification['CITIZEN'];
echo '<br/>Death Status: ';
echo $id_verification['DEATH-STATUS'];
echo '<br/>Death Date: ';
echo $id_verification['DEATH-DATE'];
echo '<br/>Death Place: ';
echo $id_verification['DEATH-PLACE'];

unset($_SESSION['id_verification']);


}
mysql_free_result($sql);
mysql_close($connection);


?>
4

1 回答 1

0

将两个搜索表单发送到一个位置。

首先你需要搜索到本地,如果不是再次在 API 中搜索它。意味着您需要在单个服务器文件中进行搜索。

希望这个清楚,否则详细告诉我。

于 2013-10-04T08:21:38.577 回答