-1
Hello, I need a help, I have the following HTML code where there is an input field for the user to enter the meter and a select where he selects the type of service, however he may need more fields as he wants to do more services, has a button where the user clicks to add amsi fields, but it is with an error as it inserts and deletes. Follows the code:
<?php
include "cabecalho.php";
if($_SESSION['usuario'] == 'logado'){
?>
<form class="row g-3" id="form_servico">
<div id="formulario-orcamento">
<div class="form-row">
<div class="form-group col-md-6">
<label for="exampleFormControlInput1">Metros</label>
<input type="email" class="form-control" id="metros" placeholder="Ex: 20">
</div>
<div class="form-group col-md-6">
<label> Tipo de Serviço </label>
<select name="cod_servico" class="form-control">
<option> ::Selecione:: </option>
<?php
require_once "conexao.php";
$sql = "SELECT id_servico, nome FROM servico ORDER BY nome";
$result = mysqli_query($conexao, $sql);
// $row = mysqli_fetch_array($result);
while($linha = mysqli_fetch_array($result)){
echo '<option value="'.$linha["id_servico"].'">'.$linha["nome"].'</option>';
}
?>
</select>
</div>
</div>
<button type="submit" id="add-campo" onclick="adicionar()" class="btn btn-primary">Adicionar mais campos</button>
</form>
<?php
}else{
header('Location: login.php');
exit();
}
include "rodape.php";
?>
$("#add-field"). click(Function add() { $("#budget-form").append('<div class="form-Row"><p>test</p></div>'); });
– Julia
It worked, thank you so much for your help!!!!
– Julia