title: Save other ID in database
body: <p>I have 2 table here : </p>
  
  <pre><code> 1. tblPurItem : 
  
      itemID, categoryID, purchaseMeasurementID, stockMeasurementID, calculationMeasurementID, retailrecipeID
  
   2. tblRecipe :
  
      recipeID, recipeName, recipeType
  
  *retailRecipeID = recipeID
  </code></pre>
  
  <p>How do I get the value retailRecipeID in tblPurItem? Because if I add like <code>(SELECT D.recipeName FROM tblPosRecipe D WHERE A.retailRecipeID = D.recipeID LIMIT 1)</code> AS recipeName , recipeName is null which is there is no data. I have to get the retailRecipeID because in this situation, I have form. Form 1 is tblPurItem and form 2 is tblRecipe. The form 1 have no problem but form 2 have problem.</p>
  
  <p>When I success to submit the form 1, the form 2 will be popup on radiobutton= yes so that form 2 success to submit data. Now, my problem is data form 2 will be lost because do not link with form 1. And retailRecipeID also null in database. Anyone know the solution? Thank you!</p>
  
  <p>It should be when I open back the form 1 and form 2 the data will displayed back but it show blank not the previous data.</p>
  
  <p><a href="https://i.stack.imgur.com/1TEfy.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1TEfy.png" alt="pic1"></a></p>
  
  <blockquote>
    <p>SQL</p>
  </blockquote>
  
  <pre><code>SELECT A.itemID, A.categoryID, A.purchaseMeasurementID, A.stockMeasurementID, A.calculationMeasurementID, A.itemName, A.itemDescription, A.itemPrice, A.lastPrice, A.averagePrice, A.itemType, A.purchaseStatus, A.cutStock, A.chargeOut, A.retailItem, A.consignment, A.marginConsignment, A.active
          , (SELECT B.itemCategoryName FROM tblPurItemCategory B WHERE A.categoryID = B.itemcategoryID LIMIT 1) AS itemCategoryName
          , (SELECT C.measurementName FROM tblPurMeasurement C WHERE A.purchaseMeasurementID= C.measurementID LIMIT 1) AS purchasemeasurementName
          , (SELECT C.measurementName FROM tblPurMeasurement C WHERE A.stockMeasurementID= C.measurementID LIMIT 1) AS stockmeasurementName
          , (SELECT C.measurementName FROM tblPurMeasurement C WHERE A.calculationMeasurementID= C.measurementID LIMIT 1) AS calculationmeasurementName
          FROM tblPurItem A 
  </code></pre>