<?$txt_subcategoria = $_POST["txt_subcategoria"];$txt_nome = $_POST["txt_nome"];$txt_numero = $_POST["txt_numero"];$txt_foto = $_POST["txt_foto"];$txt_tamanho = $_POST["txt_tamanho"];$txt_formato = $_POST["txt_formato"];$txt_upload = $_POST["txt_upload"];$txt_idioma = $_POST["txt_idioma"];$txt_link1 = $_POST["txt_link1"];$txt_link_1 = $_POST["txt_link_1"];$txt_link2 = $_POST["txt_link2"];$txt_link_2 = $_POST["txt_link_2"];$txt_link3 = $_POST["txt_link3"];$txt_link_3 = $_POST["txt_link_3"];$txt_link4 = $_POST["txt_link4"];$txt_link_4 = $_POST["txt_link_4"];foreach ($txt_subcategoria as $cod => $value){$msg .= ucfirst($cod) . ": " . $value . "\n";$sql = "INSERT INTO animesfusion_arquivos (subcat, nome, upload, numero, screen, idioma, tamanho, formato, url, url2, url3, url4, url5, url6, url7, url8) VALUES ('$txt_subcategoria','$txt_nome','$txt_upload','$txt_numero','$txt_foto','$txt_idioma','$txt_tamanho','$txt_formato','$txt_link1', '$txt_link_1','$txt_link2','$txt_link_2','$txt_link3','$txt_link_3','$txt_link4','$txt_link_4')";$consulta = mysql_query($sql) or die(mysql_error());if($consulta) {echo "<br/><center><div id=\"Aviso_ok\">Episodio Cadastrado com Sucesso</div></center><br/>";}else{echo "<br/><center><div id=\"Aviso_erro\">Erro ao Cadastrar o Episodio</div></center><br/>";}}?>
E o Formulario e esse
<?php require("./conn/conexao.php"); ?><?php/*Recebe valores da url pelo medeto get */$acao =$_GET["acao"];$id =$_GET["id"];/*verifica açao e executaconsulta*/if ($acao!= ""){$sql= "SELECT a.*,c.*, s.* FROM animesfusion_categorias c,animesfusion_subcategorias s ,animesfusion_arquivos a WHERE a.subcat =s.id and a.id = '$id' ";/*executa consulta*/$qry = mysql_query($sql);$linha = mysql_fetch_array($qry);/*recebe consulta*/ if ($_GET["consulta"] == "sim") { $id_categoria = $_GET[id_categoria]; } else { $id_categoria = $linha[id_categoria]; } $id_categoria = $linha[categoria];$id_subcategoria = $linha[subcat];$nome = $linha[nome];$upload = $linha[upload];$numero =$linha[numero];$scree =$linha[screen];$idioma =$linha[idioma];$tamanho =$linha[tamanho];$qualidade =$linha[qualidade];$formato =$linha[formato];$link1 =$linha[url];$link_1 =$linha[url2];$link2 =$linha[url3];$link_2 =$linha[url4];$link3 =$linha[url5];$link_3 =$linha[url6];$link4 =$linha[url7];$link_4 =$linha[url8]; }?><!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=iso-8859-1" /><title>Untitled Document</title><script language="javascript" type="text/javascript">function MM_jumpMenu(targ,selObj,restore){ //v3.0 eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'"); if (restore) selObj.selectedIndex=0;}//--></script><style type="text/css"><!--.style3 { color: #FFFFFF; font-weight: bold;}.style5 {color: #000000; font-weight: bold; }--></style></head><body><table width="100%" border="0"> <tr> <td bgcolor="#ff6600"><div align="center" class="style3">Cadastro De Episodios </div></td> </tr> <tr> <td bgcolor="#FF6600"><form id="form1" name="form1" method="post" action="envia.php"><br /><?php for($num=1;$num<=4;$num++){ ?> <?php echo "<h1 style=\"font-family:Impact\"> ".$num."</h1>"; ?> <table width="314" border="0" align="center" bordercolor="#000000" bgcolor="#f2f2f2"> <tr> <td><span class="style5">Categoria</span></td> <td> <select name="txt_idcategoria" id="txt_idcategoria" onchange="MM_jumpMenu('parent',this,0)"> <option></option> <?php $sql_cat= "SELECT * FROM animesfusion_categorias ORDER BY nome"; $qry_cat = mysql_query($sql_cat); while ($linha_cat = mysql_fetch_array($qry_cat)) {?> <option value="index.php?act=a&acao=<?php echo $acao; ?>&consulta=sim&id_categoria=<?php echo $linha_cat[id]; ?>&id=<?php echo $id; ?>"<?php if ($linha_cat[id] == $id_categoria) echo "selected"; ?>><?php echo $linha_cat[nome]; ?></option> <? } ?></select> </td> </tr> <?php if ($id_categoria !="") {?> <tr> <td width="68"><span class="style5">Subcategoria</span></td> <td width="236"><select name="txt_subcategoria" id="txt_subcategoria"> <option value="1">selecione uma Subcategoria</option> <?php $sql_subcat = "SELECT * FROM animesfusion_subcategorias s WHERE categoria = '$id_categoria' ORDER BY nome"; $qry_subcat = mysql_query($sql_subcat); while ($linha_subcat = mysql_fetch_array($qry_subcat)){ $valor = $linha_subcat[id]; if ($id_subcategoria == $valor) { $selecionado = "selected"; } else { $selecionado =""; } print "<option value = \"$valor\" $selecionado > $linha_subcat[nome] </option>"; } ?> </select> </td> </tr> <tr> <td width="68">Nome</td> <td><input name="txt_nome" type="text" id="txt_nome" value="<? echo $nome; ?>" /></td> </tr> <tr> <td width="68">numero</td> <td><input name="txt_numero" type="text" id="txt_numero" value="<? echo $numero; ?>" /></td> </tr> <tr> <td width="68">screen</td> <td><input name="txt_foto" type="text" id="txt_foto" value="<? echo $scree; ?>" /></td> </tr> <tr> <td width="68">tamanho</td> <td><input name="txt_tamanho" type="text" id="txt_tamanho" value="<? echo $nome; ?>" /></td> </tr> <tr> <td width="68">Formato</td> <td><label> <select name="txt_formato" size="1" id="txt_formato"> <option value="0">.MP4</option> <option value="1">.MKV</option> <option value="5">.AVI</option> <option value="6">.RMVB</option> </select> </label></td> </tr> <tr> <td width="68">Upload</td> <td><label> <select name="txt_upload" id="txt_upload"> <option value="Allenwalker">Allenwalker</option> </select> </label></td> </tr> <tr> <td width="68">idioma</td> <td><label> <select name="txt_idioma" size="1" id="txt_idioma"> <option <? echo $idioma["idioma"]==0, "selected", ""; ?> value="0">Nenhuma</option> <option <? echo $idioma["idioma"]==1, "selected", ""; ?> value="1">Português</option> <option <? echo $idioma["idioma"]==2, "selected", ""; ?> value="2">Japonês</option> <option <? echo $idioma["idioma"]==3, "selected", ""; ?> value="3">Inglês</option> <option <? echo $idioma["idioma"]==4, "selected", ""; ?> value="4">Espanhol</option> <option <? echo $idioma["idioma"]==5, "selected", ""; ?> value="5">Francês</option> </select> </label></td> </tr> <tr> <td width="68">Links</td> <td><input name="txt_link1" type="text" id="txt_link1" value="<? echo $link1; ?>" /></td> </tr> <tr> <td width="68">Links</td> <td><input name="txt_link_1" type="text" id="txt_link_1" value="<? echo $link_1; ?>" /></td> </tr> <tr> <td width="68">links2</td> <td><input name="txt_link2" type="text" id="txt_link2" value="<? echo $link2; ?>" /></td> </tr> <tr> <td width="68">links2</td> <td><input name="txt_link_2" type="text" id="txt_link_2" value="<? echo $link_2; ?>" /></td> </tr> <tr> <td width="68">links3</td> <td><input name="txt_link3" type="text" id="txt_link3" value="<? echo $link3; ?>" /></td> </tr> <tr> <td width="68">links3</td> <td><input name="txt_link_3" type="text" id="txt_link_3" value="<? echo $link_3 ; ?>" /></td> </tr> <tr> <td>links4</td> <td><input name="txt_link4" type="text" id="txt_link4" value="<? echo $link4; ?>" /></td> </tr> <tr> <td width="68">links4</td> <td><input name="txt_link_4" type="text" id="txt_link_4" value="<? echo $link_4; ?>" /></td> </tr> <tr> <td colspan="2"><label></label></td> </tr> <?php } ?> </table> <br /> <?php}?> <br /> <input name="" type="submit" value="Submit" /> </form> </td> </tr> <tr> <td bgcolor="#FF6600"> </td> </tr></table></body></html>
Sempre da esse erro
Warning: Invalid argument supplied for foreach() in C:\wamp\www\fusion\admin\envia.php on line 19
Edição feita por: alexwebcba, 12/10/2009, 11:49.