Note that there are some explanatory texts on larger screens.

plurals
  1. POmerging of search forms
    text
    copied!<p>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.</p> <p>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.</p> <p>Is this possible and how do I go about merging the two?</p> <p>Thanks for all the help guys.</p> <p>Combination of form functions:</p> <pre><code>&lt;div class="article"&gt; &lt;h2&gt; &lt;br&gt; SEARCH A REFERENCE &lt;br&gt; &lt;/h2&gt; &lt;/center&gt; &lt;body&gt; &lt;div id="formsearch"&gt; &lt;br&gt; &lt;form method="post" action="" name="form1" id="form1" &gt; Enter the ID Number &lt;br&gt;&lt;br&gt; &lt;b&gt;Search Record &lt;/b&gt; &lt;input type="text" name="term" /&gt;&lt;br /&gt; &lt;br&gt; &lt;input type="submit" name="submit" value="Search" class="btn" /&gt; &lt;/form&gt; &lt;/div&gt; &lt;h3&gt; &lt;center&gt; Search Result (s) &lt;/h3&gt; &lt;?php if ($_REQUEST['submit']) { $term = $_POST['term']; $row ['employerid'] == $user_data ['user_id']; $XX = "&lt;br&gt;&lt;br&gt;&lt;div class='messagebox'&gt;&lt;h2&gt; &lt;center&gt; Oops! &lt;/h2&gt; &lt;p&gt;We were only to retrieve a partial record on &lt;strong&gt;$term&lt;/strong&gt; 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. &lt;a href='Mailforms/refrequest.php' class='lightbox'&gt;Click Here!&lt;/a&gt; or to validate the id &lt;a href='idverification.php'&gt; Click here&lt;/a&gt;&lt;/p&gt; &lt;br /&gt; &lt;/div&gt;"; $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) &gt; 0 ) { while ($row = mysql_fetch_array($sql)){ if ($row ['employed'] == '1') { echo '&lt;h4&gt;Currently Employed By : '.$row['companyname']; echo '&lt;/h4&gt; '; echo '&lt;a href="#"&gt;Any doubts? Enquire about this candidate&lt;/a&gt; '; } if ($row ['employed'] == '0') { echo ' &lt;h4&gt;Some Available Options For:&lt;/h4&gt;'; include 'includes/admenu.php'; echo '&lt;h4&gt;Not Currently employed '.$row['companyname']; echo '&lt;/h4&gt; '; } echo "&lt;table border='1' cellpadding='10'&gt;"; echo "&lt;tr&gt; &lt;th&gt;ID Number&lt;/th&gt; &lt;th&gt;First Name&lt;/th&gt; &lt;th&gt;Last Name&lt;/th&gt;&lt;th&gt;company&lt;/th&gt; &lt;th&gt;Job Title&lt;/th&gt; &lt;th&gt;Period&lt;/th&gt;&lt;th&gt;Reason for dismissal&lt;/th&gt;&lt;th&gt;&lt;/th&gt;&lt;th&gt;&lt;/th&gt;&lt;/tr&gt;"; echo "&lt;tr&gt;"; echo '&lt;td&gt;' . $row['idnumber'] . '&lt;/td&gt;'; echo '&lt;td&gt;' . $row['firstname'] . '&lt;/td&gt;'; echo '&lt;td&gt;' . $row['lastname'] . '&lt;/td&gt;'; echo '&lt;td&gt;' . $row['companyname'] . '&lt;/td&gt;'; echo '&lt;td&gt;' . $row['jobtitle'] . '&lt;/td&gt;'; echo '&lt;td&gt;' .($row['startdate'] + $row['terminationdate']).'&lt;/td&gt;'; echo '&lt;td&gt;' . $row['dismissal'] . '&lt;/td&gt;'; echo '&lt;td&gt;&lt;a href="editemp.php?idnumber=' . $row['idnumber'] . '"&gt;Achievements&lt;/a&gt;&lt;/td&gt;'; echo '&lt;td&gt;&lt;a href="delete.php?idnumber=' . $row['idnumber'] . '"&gt;training&lt;/a&gt;&lt;/td&gt;'; echo "&lt;/tr&gt;"; } // close table&gt; echo "&lt;/table&gt;"; } } 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 '&lt;br/&gt;'; echo '&lt;h3&gt;Search Information&lt;/h3&gt;'; 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 '&lt;br/&gt;'; echo '&lt;h3&gt;Data: &lt;/h3&gt;'; echo '&lt;br/&gt;ID Number: '; echo $id_verification['IDNUMBER']; echo '&lt;br/&gt;First Names: '; echo $id_verification['FIRSTNAMES']; echo '&lt;br/&gt;Last Name: '; echo $id_verification['SURNAME']; echo '&lt;br/&gt;Birthday: '; echo $id_verification['BIRTHDAY']; echo '&lt;br/&gt;Age: '; echo $id_verification['AGE']; echo '&lt;br/&gt;Gender: '; echo $id_verification['GENDER']; echo '&lt;br/&gt;Citizen: '; echo $id_verification['CITIZEN']; echo '&lt;br/&gt;Death Status: '; echo $id_verification['DEATH-STATUS']; echo '&lt;br/&gt;Death Date: '; echo $id_verification['DEATH-DATE']; echo '&lt;br/&gt;Death Place: '; echo $id_verification['DEATH-PLACE']; unset($_SESSION['id_verification']); } mysql_free_result($sql); mysql_close($connection); ?&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload