Veamos, mas ampliamente, hay un formulario para rellenar con campos de texto y movidas, lo que quiero es que cuando le de al ultimo boton (añadir documento) me vaya al php adecuado (inserciondocumento.php), el problema esta en, si le doy una vez pasa de mi y va a anyadirdoc.php. Todo el codigo es:
Código PHP:
<form action= "<? if(isset($_POST["AnyadirDocumento"])) { echo "InsercionDocumento.php";} else { echo "AnyadirDoc.php";} ?>" method="post" enctype="multipart/form-data" name="form1">
<table width="200" border="0">
<tr>
<td><div align="center"><u><strong><span class="style1">AÑADIR DOCUMENTO</span></strong></u></div></td>
</tr>
</table>
<table width="308" border="0">
<tr>
<td width="64">Nombre:</td>
<td width="240"><input name="nombre" type="text" size="50" value="<? echo $_POST['nombre']; ?>" ></td>
</tr>
</table>
<table width="240" border="0">
<tr>
<td width="81">Referencia:</td>
<td width="149"><input type="text" name="referencia" value="<? echo $_POST['referencia']; ?>"></td>
</tr>
</table>
<table width="402" border="0">
<tr>
<td width="239">Fecha de publicación (dd-mm-aaaa): </td>
<td width="153"><input type="text" name="fecha" value="<? echo $_POST['fecha']; ?>"></td>
</tr>
</table>
<table width="298" border="0">
<tr>
<td>Número de páginas: </td>
<td><input type="text" name="paginas" value="<? echo $_POST['paginas']; ?>"></td>
</tr>
</table>
<table width="596" border="0">
<tr>
<td width="102" height="100">Resumen:</td>
<td width="484"><textarea name="resumen" cols="75" rows="5"><? echo $_POST['resumen']; ?></textarea></td>
</tr>
</table>
<table width="200" border="0">
<tr>
<td> </td>
</tr>
</table>
<table width="267" border="0">
<tr>
<td width="154">Tipo de documento: </td>
<td width="103"><p>
<label> </label>
<label> </label>
<select name="tipoDoc" onChange="cambiarTipo()">
<option value="Libro">Libro
<option value="Articulo">Articulo
</select>
<br>
</p></td>
</tr>
</table>
<table width="200" border="0">
<tr>
<td> </td>
</tr>
</table>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<table width="200" border="0">
<tr>
<td> </td>
</tr>
</table>
<table width="200" border="0">
<tr>
<td><div align="center"><strong><span class="style1">AUTORES</span></strong></div></td>
</tr>
</table>
<table width="608" border="0">
<tr>
<td><? if(count($_POST['nombreAut']) > 0)
{
foreach($_POST["nombreAut"] as $nomAut)
{
//echo "<br>DNI: "."$dni";
?>
<input type="hidden" name="nombreAut[]" value="<? echo $nomAut; ?>">
<tr><td>AUTOR: </td><td><? echo $nomAut; echo "<br>"; ?></td></tr>
<?
}
}
?>
</td>
<td width="135">Nombre y Apellidos:</td>
<td width="463"><input type="text" name="nombreAut[]" width="450"></td>
</tr>
</table>
<table width="200" border="0">
<tr>
<td> </td>
</tr>
</table>
<table width="487" border="0">
<tr>
<td width="481"><div align="right">
<input type="submit" name="AnyadirAutor" value="Añadir Autor">
</div></td>
</tr>
</table>
<table width="200" border="0">
<tr>
<td> </td>
</tr>
</table>
<table width="521" border="0">
<tr>
<td width="224" height="38"><div align="center"><strong><span class="style1">CATÁLOGO/S ASOCIADOS </span></strong></div></td>
</tr>
</table>
<table width="234" border="0">
<tr>
<td><? if(count($_POST['nomCat']) > 0)
{
foreach($_POST["nomCat"] as $nomCat)
{
//echo "<br>DNI: "."$dni";
?>
<input type="hidden" name="nomCat[]" value="<? echo $nomCat; ?>" >
<tr><td>CATÁLOGO: </td><td><? echo $nomCat; echo "<br>"; ?></td></tr>
<?
}
}
?>
</td>
<td width="67">Nombre:</td>
<td width="157"><input type="text" name="nomCat[]"></td>
</tr>
</table>
<table width="200" border="0">
<tr>
<td> </td>
</tr>
</table>
<table width="499" border="0">
<tr>
<td width="481"><div align="right">
<input type="submit" name="AsignarCatalogo" value="Asignar Catálogo">
</div></td>
</tr>
</table>
<table width="200" border="0">
<tr>
<td> </td>
</tr>
</table>
<table width="200" border="0">
<tr>
<td><div align="center"><strong><span class="style1">TEMÁTICA</span></strong></div></td>
</tr>
</table>
<table width="234" border="0">
<tr>
<td><? if(count($_POST['nomTema']) > 0)
{
foreach($_POST["nomTema"] as $nomTema)
{
//echo "<br>DNI: "."$dni";
?>
<input type="hidden" name="nomTema[]" value="<? echo $nomTema; ?>" >
<tr>
<td>TEMA: </td>
<td><? echo $nomTema; echo "<br>"; ?></td></tr>
<?
}
}
?>
</td>
<td width="67">Nombre:</td>
<td width="157"><input type="text" name="nomTema[]"></td>
</tr>
</table>
<table width="200" border="0">
<tr>
<td> </td>
</tr>
</table>
<table width="499" border="0">
<tr>
<td width="481"><div align="right">
<input type="submit" name="AnyadirTema" value="Añadir Tema">
</div></td>
</tr>
</table>
<div id="Articulo" style="position:absolute; width:200px; height:115px; z-index:2; visibility: hidden; left: 11px; top: 341px;">
<table width="200" border="0">
<tr>
<td><div align="center"><strong><span class="style1">ARTÍCULO</span></strong></div></td>
</tr>
</table>
<table width="430" border="0">
<tr>
<td width="79">Gratuito
<input name="radiobutton" type="radio" value="gratuito" <? if ($_POST['radiobutton'] == "gratuito") { echo "checked"; } ?>></td>
<td width="65">Pago
<input name="radiobutton" type="radio" value="pago" <? if ($_POST['radiobutton'] == "pago") { echo "checked"; } ?>></td>
<td width="68"><div align="right">Importe:</div></td>
<td width="153"><input type="text" name="importe" value="<? echo $_POST['importe']; ?>"></td>
<td width="43"><div align="left">€</div></td>
</tr>
</table>
<table width="432" border="0">
<tr>
<td width="48"><div align="left">Ruta:</div></td>
<td width="374"><input type="text" name="rutaArt" value="<? echo $_POST['rutaArt']; ?>"></td>
</tr>
</table>
</div>
<table width="200" border="0">
<tr>
<td> </td>
</tr>
</table>
<div id="Libro" style="position:absolute; width:409px; height:163px; z-index:1; top: 341px; left: 12px; visibility: visible;">
<table width="200" border="0">
<tr>
<td><div align="center"><strong><span class="style1">LIBRO</span></strong></div></td>
</tr>
</table>
<table width="200" border="0">
<tr>
<td width="46">ISBN:</td>
<td width="144"><input type="text" name="isbn" value="<? echo $_POST['isbn']; ?>"></td>
</tr>
</table>
<table width="216" border="0">
<tr>
<td width="62">Editorial:</td>
<td width="144"><input type="text" name="editorial" value="<? echo $_POST['editorial']; ?>"></td>
</tr>
</table>
<table width="212" border="0">
<tr>
<td width="58">Edición:</td>
<td width="144"><input type="text" name="edicion" value="<? echo $_POST['edicion']; ?>"></td>
</tr>
</table>
<table width="405" border="0">
<tr>
<td width="80">Digital
<input type="checkbox" name="digital" value="digital" <? if ($_POST['digital'] == "digital") { echo "checked"; } ?>></td>
<td width="90"><div align="right">Ruta:</div></td>
<td width="221"><input type="text" name="rutaLD" value="<? echo $_POST['rutaLD']; ?>"></td>
</tr>
</table>
<table width="200" border="0">
<tr>
<td>Físico
<input type="checkbox" name="fisico" value="fisico" <? if ($_POST['fisico'] == "fisico") { echo "checked"; } ?>></td>
</tr>
</table>
</div>
<table width="488" border="0">
<tr>
<td width="482"><div align="right">
<input type="submit" name="AnyadirDocumento" value="Añadir Documento">
</div></td>
</tr>
</table>
</form>
Gracias