<?php require "conexao.php"; function anT($sql){ $sql = preg_replace("/(from|select|insert|delete|where|drop|#|\*|--|\\\\)/i","",$sql); if (!get_magic_quotes_gpc()) { $sql = (is_array($sql)) ? array_map('mysql_escape_string',$sql) : mysql_escape_string($sql); } return htmlspecialchars($sql); } if(getenv("REQUEST_METHOD") == "POST"){ $novo = array_map("anT",$_POST); foreach($novo as $campo => $valor){ $erroR = "Erro ao tentar atualizar o campo <u>".$campo."</u> com o valor <u>".$valor."</u>"; mysql_query("UPDATE `tabela` SET `".$campo."` = '".$valor."' WHERE nome='atual'") or die($erroR); } // Fim do foreach() exit("Dados Atualizados com Sucesso!"); } // Se for m�todo POST else{ echo "<form action=\"eu.php\" method='post'> <center> <input type=text name='data'><br> <input type=text name='data2'><br> <input type=text name='obs'><br> <Br><br><input type=submit value=enviar> </form> "; } ?>