Dear, I would like you to help me, I'm doing an insert with php and sql server for which you register correctly but the problem is that when I update the page you register how I can avoid that.
this is my code:
<table class="table">
<tr>
<td>Año Electivo</td>
<td> <select name="AnioID" class="form-control">
<option value="0">--Seleccionar--</option>
<?php
$sql = "EXEC AGE_Mantenimiento_AnioLectivo 1,'','','','','' " ;
$result = sqlsrv_query($conn,$sql) or die("Couldn't execut query");
while ($data=sqlsrv_fetch_array($result, SQLSRV_FETCH_ASSOC)){
echo '<option value="'.$data['nAnioID'].'">';
echo $data['Anio'];
echo "</option>";
}
?>
</select></td>
</tr>
<tr>
<td>Descripción</td>
<td><textarea class="form-control" rows="5" id="Descripcion" name="txtdescripcioninstitucion" placeholder="Ingrese una descripión" ></textarea></td>
</tr>
<tr style="visibility: hidden;">
<td>Numero de Carpetas</td>
<td><input type="number" name="txtnumerocarpetas" placeholder="Ingrese el Numero de Carpetas" class="form-control"></td>
</tr>
<tr>
<td colspan="2" class="text-center">
<button type="submit" name="Guardar" class="btn btn-primary">Guardar</button>
</td>
</tr>
</table>
<?php
if(isset($_POST['Guardar'])){
$t2=$_POST['AnioID'];
$t3=$_POST['txtdescripcioninstitucion'];
$sql ="
EXEC AGE_Mantenimiento_Institucion 2,'$t2','$t3'
";
$params = array('$t1','$t2','$t3');
$stmt = sqlsrv_query($conn, $sql, $params);
sqlsrv_close($conn);
if( $stmt === false ) {
echo "<script language=\"JavaScript\">\n";
echo "alert('EL USUARIO NO EXISTE');\n";
echo "</script>";
}else{
echo "<script>";
echo "reset();";
echo "</script>";
}
}
?>