Ola tenho um formulário e não consigo arrumar ele pra dar submit automaticamente quando entrar na página . alguem pode me ajudar ? vo postar codigo abaixo ..
<?
include "proteger.php"; //inclui o arquivo de configurações
?>
<?php
require('class.mysql.php');
require('config.inc.php');
if($_POST['Submit']){
$nick = $_POST['nick'];
if(substr_count($nick,' ') == strlen($nick)){
$erro = 'Apelido não pode conter somente espaços em branco.';
}else{
//evitando problemas com javascript ',"",(,),|
$nick = str_replace('"',' ',$nick);
$nick = str_replace(';','',$nick);
$nick = str_replace('(','',$nick);
$nick = str_replace(')','',$nick);
$nick = str_replace("'"," ",$nick);
$nick = str_replace('|','',$nick);
$nick = sql_inject($nick);
$login = $hebert['login'];
$sql = new Mysql;
//deleta usuarios sem atividade
$sql->Consulta("DELETE FROM $tabela_usu WHERE tempo < $tempovida");
//deleta mensagens antigas
$sql->Consulta("DELETE FROM $tabela_msg WHERE tempo < $tempovida");
//total de usuários online
$totalonline = $sql->Totalreg("SELECT COUNT(*) FROM $tabela_usu");
if($totalonline == 0){
include('deletarimg.php');
}
//verificando se ja tem este nick
$total = $sql->Totalreg("SELECT COUNT(*) FROM $tabela_usu WHERE nick='$nick'");
if($total > 0){
$erro = 'Este apelido ja está em uso.';
}else{
$ip = $_SERVER['REMOTE_ADDR'];
//insere usuário
$sql->Consulta("INSERT INTO $tabela_usu
(nick,frase,cor,ip,tempo)
VALUES
('$nick','','#006699','$ip','$tempo_usu')");
//insere no chat
$sql->Consulta("INSERT INTO $tabela_msg
(reservado,usuario,cor,msg,falacom,tempo)
VALUES
('0','$nick','#006699','entrou na sala.','Todos','$tempo_msg')");
//inicia a sessao
session_start();
$_SESSION[usu_nick] = $nick;
//redireciona
header('Location:principal.php');
}
}
}
?>
<?php
$id = $_SESSION["login_clube"];
$resultado = mysql_query("SELECT * FROM usuarios_clube WHERE login='$id'");
while($hebert = mysql_fetch_assoc($resultado)){
$login = $hebert['login'];
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Chat -RadioAvatar</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script type="text/javascript">
function desabilita(){
document.form1.Submit2.disabled = true;
//document.form1.Submit.value = 'Enviando...';
}
</script>
<style type="text/css">
<!--
.style2 {color: #666666}
-->
</style>
<link rel="stylesheet" type="text/css" href="estilo.css" />
</head>
<body>
<div align="center">
<table width="338" border="0" cellspacing="0" cellpadding="5" class="borda">
<tr>
<td height="71"><div align="center"><img src="icones/logo.jpg" width="268" height="123"></div></td>
</tr>
<tr>
<td height="28" align="center" class="texto11"><?=$erro;?></td>
</tr>
<tr>
<td height="58" align="center"> <form name="form1" method="post" action="index.php" onSubmit="desabilita()">
Confirme o seu nome :
<input name="nick" type="text" class="form" value="<? echo "$login" ?>" size="15" maxlength="20">
<input type="hidden" name="Submit" value="1">
<input type="submit" name="Submit2" value="Entrar" class="form">
</form></td>
</tr>
<tr>
<td height="5"><script type="text/javascript" src="
http://ajax.googleap...n.js"></script>
<script type="text/javascript" src="js2/javascript.js"></script></td>
</tr>
<tr>
<td height="14" align="center"><p>
<span class="style2">2011
<a href="URL" target="_blank">URL</a></span></p>
</td>
</tr>
</table>
</div>
</body>
</html>