我有2个搜索表单。一个链接到我的本地记录数据库,另一个链接通过API链接到另一个数据库。
我想现在当我的数据库没有所需的记录时,让它使用第二个搜索表单而不需要用户再次插入数据。
这可能吗?如何合并两者呢?
感谢所有帮助人员。
表单函数的组合:
<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);
?>
答案 0 :(得分:0)
将两个搜索表单发送到一个位置。
首先,您需要搜索本地,如果不再在API中搜索它。意味着您需要在单个服务器文件中进行搜索。
希望这个明确的另外发布我的细节。