Ver Mensaje Individual
  #1 (permalink)  
Antiguo 03/01/2012, 16:01
cheterporras2
 
Fecha de Ingreso: octubre-2011
Mensajes: 160
Antigüedad: 12 años, 6 meses
Puntos: 2
Diversos errores en mi código

Hola:

Sé que tengo varios errores en mi código, pero por mucho que he buscado, no encuentro solución. Os explico: tengo un formulario en html, el correspondiente código en php y la bd. En el html quiero que la gente pueda subir fotos en la carpeta "imagen" que tengo en mi servidor y la ruta a la bd, lo he intentado hacer, pero no funciona (tiene q estar mal por todas partes...). Por otra parte, me gustaría que mi formulario pudiera hacer dos actions y he usado un código que he encontrado por aquí, pero tampoco funciona. ¿Cómo puedo modificar el código para que ambas cosas vayan correctamente? Muchas gracias.
HTML:
Código PHP:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Documento sin título</title>
<link href="file:///C|/Users/ESTHER/Desktop/animalmeeting/estilos.css" rel="stylesheet" type="text/css" />
<link href="file:///C|/Users/ESTHER/Desktop/animalmeeting/registro2.css" rel="stylesheet" type="text/css" />

<script language="javascript">
function envio_form(){
document.formulario.target = "_blank"; 
document.formulario.action = "registrandose.php";
document.formulario.id.value="formulario";
document.formulario.submit();
document.formulario.target = "_self";
document.formulario.id.value="imagen";
document.formulario.action = "<?php echo $editFormAction?>";
document.formulario.submit();
}
</script>


</head>

<body class="fondoregistro">
<form action="" method="post" enctype="multipart/form-data" name="formulario" id="formulario">
  <table width="1024" height="768" border="0">
    <tr>
      <td width="304" height="768"><table width="100%" height="768" border="0">
        <tr>
          <td height="350" colspan="2">
          <img src="imagen/<?php if(!empty($error)){echo 'cancelar';}elseif(!empty($respuesta)){echo 'acept';}else{echo '';}?>.png" width="<?php if(!empty($error)){echo '48';}elseif(!empty($respuesta)){echo '48';}else{echo '0';}?>" height="<?php if(!empty($error)){echo '48';}elseif(!empty($respuesta)){echo '48';}else{echo '0';}?>" />
          <?php if(!empty($error)){echo 'Error: este formato no es permitido';}elseif(!empty($respuesta)){echo 'Su archivo se ha enviado exitosamente';}else{echo '';}?>
         
          </td>
        </tr>
        <tr>
          <td width="84%" height="124">
           <input name="enviar2" type="image" class="botonsubir" onclick="MM_validateForm('tipo','','R');return document.MM_returnValue" src="imagenes/subir.png" />
          <label for="imagen"></label>
            <input name="imagen" type="file" class="subirfoto" id="imagen" size="12" />
            <input type="hidden" name="MM_insert" value="form1" />
<input name="nombre" type="hidden" id="nombre" value="<?php echo $_SESSION['Usuario']; ?>" />
            </td>
          <td width="16%"><input name="button" type="submit" class="botonenvio" id="button" value="Enviar" /></td>
        </tr>
        <tr>
          <td height="148" colspan="2">&nbsp;</td>
        </tr>
      </table></td>
      <td width="335"><table width="100%" height="768" border="0">
        <tr>
          <td height="103">&nbsp;</td>
        </tr>
        <tr>
          <td height="60"><label for="pais"></label>
            <input name="pais" type="text" class="pais" id="pais" maxlength="40" /></td>
        </tr>
        <tr>
          <td height="21">&nbsp;</td>
        </tr>
        <tr>
          <td height="52"><label for="provincia"></label>
            <input name="provincia" type="text" class="provincia" id="provincia" maxlength="40" /></td>
        </tr>
        <tr>
          <td height="15">&nbsp;</td>
        </tr>
        <tr>
          <td height="57"><label for="ciudad"></label>
            <input name="ciudad" type="text" class="ciudad" id="ciudad" maxlength="40" /></td>
        </tr>
        <tr>
          <td height="5">&nbsp;</td>
        </tr>
        <tr>
          <td height="45"><label for="zona"></label>
            <input name="zona" type="text" class="zona" id="zona" maxlength="40" /></td>
        </tr>
        <tr>
          <td height="21">&nbsp;</td>
        </tr>
        <tr>
          <td height="50"><label for="especie"></label>
            <input name="especie" type="text" class="especie" id="especie" maxlength="40" /></td>
        </tr>
        <tr>
          <td height="15">&nbsp;</td>
        </tr>
        <tr>
          <td height="57"><label for="raza"></label>
            <input name="raza" type="text" class="raza" id="raza" maxlength="40" /></td>
        </tr>
        <tr>
          <td height="5">&nbsp;</td>
        </tr>
        <tr>
          <td height="45"><label for="edad"></label>
            <input name="edad" type="text" class="edad" id="edad" maxlength="3" /></td>
        </tr>
        <tr>
          <td height="15">&nbsp;</td>
        </tr>
        <tr>
          <td height="61"><label for="sexo"></label>
            <select name="sexo" class="sexo" id="sexo">
<option>hembra</option>
<option>macho</option>
            </select></td>
        </tr>
        <tr>
          <td height="46">&nbsp;</td>
        </tr>
      </table></td>
      <td width="371"><table width="100%" height="768" border="0">
        <tr>
          <td height="103" colspan="2">&nbsp;</td>
        </tr>
        <tr>
          <td width="43%" height="60"><input name="pedigri" type="radio" class="si" id="radio" value="si" checked="checked" />
            <label for=""></label></td>
          <td width="57%"><input name="pedigri" type="radio" class="no" id="radio2" value="no" />
            <label for="radio2"></label></td>
        </tr>
        <tr>
          <td height="21" colspan="2">&nbsp;</td>
        </tr>
        <tr>
          <td height="52" colspan="2"><label for="capa"></label>
            <input name="capa" type="text" class="capa" id="capa" maxlength="20" /></td>
        </tr>
        <tr>
          <td height="15" colspan="2">&nbsp;</td>
        </tr>
        <tr>
          <td height="57" colspan="2"><label for="nombreamo"></label>
            <input name="nombreamo" type="text" class="nombreamo" id="nombreamo" maxlength="30" /></td>
        </tr>
        <tr>
          <td height="5" colspan="2">&nbsp;</td>
        </tr>
        <tr>
          <td height="45" colspan="2"><label for="telefono"></label>
            <input name="telefono" type="text" class="telefono" id="telefono" maxlength="15" /></td>
        </tr>
        <tr>
          <td height="21" colspan="2">&nbsp;</td>
        </tr>
        <tr>
          <td height="50" colspan="2"><label for="email"></label>
            <input name="email" type="text" class="email" id="email" maxlength="35" /></td>
        </tr>
        <tr>
          <td height="15" colspan="2">&nbsp;</td>
        </tr>
        <tr>
          <td height="57" colspan="2"><label for="usuario"></label>
            <input name="usuario" type="text" class="usuario" id="usuario" maxlength="40" /></td>
        </tr>
        <tr>
          <td height="5" colspan="2">&nbsp;</td>
        </tr>
        <tr>
          <td height="45" colspan="2"><label for="contrasenna"></label>
            <input name="contrasenna" type="password" class="contrasena" id="contrasenna" maxlength="25" /></td>
        </tr>
        <tr>
          <td height="15" colspan="2">&nbsp;</td>
        </tr>
        <tr>
          <td height="61" colspan="2"><label for="repcontrasenna"></label>
            <input name="repcontrasenna" type="password" class="repcontrasenna" id="repcontrasenna" maxlength="25" /></td>
        </tr>
        <tr>
          <td height="46" colspan="2">&nbsp;</td>
        </tr>
      </table></td>
    </tr>
  </table>
</form>
</body>
</html>