Foros del Web » Programando para Internet » PHP »

problema con array_key_exists

Estas en el tema de problema con array_key_exists en el foro de PHP en Foros del Web. tengo este code en un .php Código: <table border="0" cellspacing="0" cellpadding="0" width="100%"> <tr><td><img src="../imagenes/img_07.gif" width="124" height="47" border="0"></td></tr> </table> <? espacios("100%",2,"","../"); espacios("99%",1,"#CCCCCC","../");?> <table border="0" cellpadding="0" cellspacing="0" ...
  #1 (permalink)  
Antiguo 03/03/2005, 06:52
Avatar de markshock  
Fecha de Ingreso: abril-2004
Ubicación: Allí, al fondo a la izqui
Mensajes: 316
Antigüedad: 20 años
Puntos: 0
problema con array_key_exists

tengo este code en un .php

Código:
			<table border="0" cellspacing="0" cellpadding="0" width="100%">
				<tr><td><img src="../imagenes/img_07.gif" width="124" height="47" border="0"></td></tr>
			</table>
			<? espacios("100%",2,"","../");
				 espacios("99%",1,"#CCCCCC","../");?>
			<table border="0" cellpadding="0" cellspacing="0" width="99%">
				<tr>
					<td width="1" bgcolor="#CCCCCC"><img src="../imagenes/clear_pixel.gif" width="1" height="1" border="0"></td>
					<form name="form1" method="post" action="004.php" onSubmit="return validarRegistro(this);" enctype="multipart/form-data">
						<input type="Hidden" name="accion" value="1">
						<input type="Hidden" name="urlDestino" value="003.php">
					<td bgcolor="#F5F5F5" valign="top" align="center"><!-- inicio listado del contenido y las secciones-->
					<table border="0" cellpadding="0" cellspacing="0" width="100%">
						<tr><td bgcolor="#80B5D7"><img src="../imagenes/clear_pixel.gif" width="1" height="3" border="0"></td></tr>
						<tr><td bgcolor="#3872B2"><img src="../imagenes/clear_pixel.gif" width="1" height="18" border="0"></td></tr>
					</table>
					<? espacios("100%",12,"","../");?>
					<table border="0" cellpadding="0" cellspacing="0" width="97%">
						<tr>
							<td valign="top"><!--form noticias-->
							<table border="0" cellspacing="0" cellpadding="0" width="100%">
								<tr>
									<td width="80" class="texto2">país</td>
									<td><select name="id_pais">
										<option value="">selecciona uno</option>
										<option value="">- - - - - - - - - - - - - - - - - - - - - -</option>
<?								$total = count($array_pais);
									for($x = 1; $x < $total; $x++){?>
										<option value="<?=$array_pais[$x]["id"];?>"><?=$array_pais[$x]["name"];?></option>
<?								}?>
									</select></td>
								</tr>
							</table>
							<? espacios("100%",15,"","../");?>
							<table border="0" cellspacing="0" cellpadding="0" width="100%">
								<tr>
									<td width="80" class="texto2">descripción</td>
									<td></td>
								</tr>
								<tr><td colspan="2"><? espacios("100%",5,"","../");?></td></tr>
								<tr><td colspan="2"><textarea name="descripcion" cols="82" rows="7" onKeyDown="textCounter(document.form1.descripcion,document.form1.counter3,400)" onKeyUp="textCounter(document.form1.descripcion,document.form1.counter3,400)" class="text"></textarea></td></tr>
								<tr><td colspan="2"><input type="text" readonly="yes" name="counter3" size="3" maxlength="3" value="400" class="counter"> carácteres restantes.</td></tr>
							</table>
							<? espacios("100%",15,"","../");?>
							<table border="0" cellspacing="0" cellpadding="0" width="100%">
								<tr>
									<td width="80" class="texto2">coach</td>
									<td><input type="text" name="coach" size="67" maxlength="40" class="formText"></td>
								</tr>
							</table>
							<? espacios("100%",15,"","../");?>
							<table border="0" cellspacing="0" cellpadding="0" width="100%">
								<tr>
									<td width="80" class="texto2">t. assistant</td>
									<td><input type="text" name="assistant" size="67" maxlength="40" class="formText"></td>
								</tr>
							</table>
							<? espacios("100%",15,"","../");?>
							<table border="0" cellspacing="0" cellpadding="0" width="100%">
								<tr>
									<td width="80" class="texto2">h. delegation</td>
									<td><input type="text" name="delegation" size="67" maxlength="40" class="formText"></td>
								</tr>
							</table>
							<? espacios("100%",15,"","../");?>
							<table border="0" cellspacing="0" cellpadding="0" width="100%">
								<tr>
									<td width="80" class="texto2">captain</td>
									<td><input type="text" name="captain" size="67" maxlength="40" class="formText"></td>
								</tr>
							</table>
							<? espacios("100%",15,"","../");?>
							<table border="0" cellspacing="0" cellpadding="0" width="100%">
								<tr>
									<td width="80" class="texto2">doctor</td>
									<td><input type="text" name="doctor" size="67" maxlength="40" class="formText"></td>
								</tr>
							</table>
							<? espacios("100%",15,"","../");?>
							<table border="0" cellspacing="0" cellpadding="0" width="100%">
								<tr>
									<td width="80" class="texto2">uniform 1</td>
									<td><input type="text" name="uniform1" size="67" maxlength="40" class="formText"></td>
								</tr>
							</table>
							<? espacios("100%",15,"","../");?>
							<table border="0" cellspacing="0" cellpadding="0" width="100%">
								<tr>
									<td width="80" class="texto2">uniform 2</td>
									<td><input type="text" name="uniform2" size="67" maxlength="40" class="formText"></td>
								</tr>
							</table>
							</td><!--fin form noticias-->
							<td width="1" bgcolor="#666666"><img src="../imagenes/clear_pixel.gif" width="1" height="1" border="0"></td>
							<td width="9">&nbsp;</td>
							<td width="375" valign="top"><!--inicio extras-->
							<table border="0" cellspacing="0" cellpadding="0" width="100%">
								<tr>
									<td width="80" class="texto2">foto equipo</td>
									<td><input type="file" name="foto_equipo[]" size="35" class="formText"></td>
								</tr>
							</table>
							</td><!--fin extras-->
						</tr>
					</table>
					<? espacios("100%",25,"","../");?>
					<table border="0" cellpadding="0" cellspacing="0" width="97%">
						<tr><td><input type="submit" name="botonS" value="Insertar equipo" class="button"></td></tr>
					</table>
contiene un formulario, con un campo file llamado name="foto_equipo[]" para subir ua imagen del equipo.

pero cuando en el php donde inserto en la base de datos hago esto...

Código:
if(array_key_exists("foto_equipo", $_POST)){
	echo('hay foto del equipo<br>');
	$img_equipo = true;
	$num_img_equipo = count($_POST["foto_equipo"]);
}else{
	echo('no hay foto del equipo<br>');
}
me imprime que "no hay foto del equipo" y yo en el form le he metido una imagen para q subirla!!!

mesta volviendo loco!

thanks
__________________
Señoooraaaa!! Que camisetas!!!

"Hay 10 tipos de personas, las que piensan en binario y las que no"
_________________________________
  #2 (permalink)  
Antiguo 03/03/2005, 08:36
O_O
 
Fecha de Ingreso: enero-2002
Ubicación: Santiago - Chile
Mensajes: 34.417
Antigüedad: 22 años, 3 meses
Puntos: 129
Si revisas bien la documentación de PHP sobre "upload" de archivos .. veras que de un campo file de HTML .. tu archivo sube por el array superglobal $_FILES .. no en $_POST

Repasa la documentación oficial:
http://www.php.net/manual/en/features.file-upload.php


Un saludo,
  #3 (permalink)  
Antiguo 04/03/2005, 03:03
Avatar de markshock  
Fecha de Ingreso: abril-2004
Ubicación: Allí, al fondo a la izqui
Mensajes: 316
Antigüedad: 20 años
Puntos: 0
gracias cluster... no habia caid en eso.. thanks thanks
__________________
Señoooraaaa!! Que camisetas!!!

"Hay 10 tipos de personas, las que piensan en binario y las que no"
_________________________________
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 06:43.