-1
I have a form for registering revenue. When I finish the registration, the revenue is added in the table "recipes". All ingredients are also in a separate table called "ingredients".
My form looks like this:
<form>
<input type="text" name="receita" id="receita">
<input type="text" name="ingrediente" id="ingrediente">
<button id="addingrediente">Adicionar ingrediente</button>
<input type="textarea" name="ingredientes" id="ingredientes">
</form>
I already have a script that queries in the database, as it writes the ingredient it brings the name and when clicking on the name it adds in the ingredients field.
So I wanted, if he didn’t find the ingredient, by clicking Add ingredient, he would take the value that is in the ingredient field and add in the table "ingredients".
Enter the code of
addingrediente
– danilo
just make a
if
return of the ingredients query, and check whether the result set has Count = 0– danilo
And if the field is empty?
– Sam
If you do not find anything the field will be empty. What does Javascript have to do with it? You are using Ajax?
– Sam