how to solve HTTP/1.1 302 Found error when trying to get contents of a form in php?

Gendrith picture Gendrith · Apr 20, 2012 · Viewed 95.2k times · Source

I'm having a bug in my aplication, when I try to submit a form (POST Method) with a lot of information, an HTTP/1.1 302 Found error occur to the file that receive the info and make a redirrection to my index

The html code and php are both simple, but the info is big

The code of the form

    <form name="resena" action="consultas/resena.php" method="post" enctype="multipart/form-data">
<fieldset>
    <legend><?php echo $titulo; ?> una reseña</legend>
    <br /><br /><label for="titulo">Título</label><input type="text" name="titulo" id="titulo" size="45" maxlength="100" value="<?php echo $con["titulo"]; ?>" placeholder="hasta 70-100 caracteres o menos" titulo="hasta 70-100 caracteres o menos" onkeyup="texto(titulo)" required />
    <br /><br /><label for="fecha">Fecha</label><input type="text" name="fecha" id="fecha" size="12" maxlength="10" value="<?php echo $con["fecha"]; ?>" placeholder="Fecha" required="required" readonly="readonly" /><input name="f_b" type="button" id="f_b" value="...">
    <br /><br /><label for="resumen">Resumen</label><textarea name="resumen" id="resumen" cols="60" rows="4" wrap="hard" onkeyup="texto_tarea(resumen);"><?php echo $con["resumen"]; ?></textarea>
    <br /><br /><label for="eventos">Evento relacionado</label><select name="eventos" title="eventos"><option value=""></option><?php $s_ev=mysql_query("SELECT * FROM eventos"); while($v_ev=mysql_fetch_array($s_ev)){?><option value="<?php echo $v_ev["id_prod"];?>" <?php if($evento==$v_ev["id_ev"]){?>selected="selected"<?php } ?>><?php echo $v_ev["titulo"]?></option><?php } ?></select>
    <br /><br /><input type="submit" name="Aceptar" value="Aceptar" class="bot" style="float:left;" />&nbsp;&nbsp;<input type="reset" name="Vaciar Formulario" value="Vaciar Formulario" class="bot" />
</fieldset>
</form>
<?php 
    include("ckeditor.php");
    $CKEditor = new CKEditor();
    $CKEditor->basePath = '/edicion/';
    $CKEditor->replaceAll();
?>
<script>Calendar.setup({inputField:"fecha", ifFormat:"%Y/%m/%d",button:"f_b"});</script>

The receptor is has only the query to the database

Answer

Andreas Linden picture Andreas Linden · Apr 20, 2012

302 is not an error but a redirect to a temporary location. You could resend the request to the new location received in the response header.