Ir para conteúdo
Fórum Script Brasil
  • 0

Dados Do Form


glugani

Pergunta

3 respostass a esta questão

Posts Recomendados

  • 0
Guest - marcelo -

+ ou - assim

Voce tem um textfied

tipo <input type="text"name= "LOGIN";

Se voce quiser ´puxar essa varaivel tipo pra ver se ela esta setada pode fazer o segunite:

$teste = if (!isset($_POST["login"])){
echo "esta setada"}
echo $teste;// vai aparecer o nome que voce digitou no campo do seu fornulario
else{
echo "não esta setada";}

isso no metodo POST se for no metodo GET é só trocar POST por GET.

CERTO!"!!

Link para o comentário
Compartilhar em outros sites

  • 0

então so q o problema é q eu não estou postando isso...

olha so !


<script Language='JavaScript'>
//Função para colocar algumas mascaras...
/*
Cep <input type="text" name="str_cep" maxlength="9" size="9" onKeyPress="return txtBoxFormat(document.Form, 'str_cep', '99999-999', event);">
CPF <input type="text" name="str_cpf" maxlength="14" size="14" onKeyPress="return txtBoxFormat(document.Form, 'str_cpf', '999.999.999 99', event);">
CNPJ <input type="text" name="str_cnpj" maxlength="18" size="18" onKeyPress="return txtBoxFormat(document.Form, 'str_cnpj', '99.999.999/9999-99', event);">
Data <input type="text" name="str_data" maxlength="10" size="10" onKeyPress="return txtBoxFormat(document.Form, 'str_data', '99/99/9999', event);">
Tel Residencial <input type="text" name="str_tel2" maxlength="14" size="14" onKeyPress="return txtBoxFormat(document.Form, 'str_tel2', '(99) 9999-9999', event);"
Tel Celular&nbsp <input type="text" name="str_tel" maxlength="14" size="14" onKeyPress="return txtBoxFormat(document.Form, 'str_tel', '(99) 9999-9999', event);">
Processo <input type="text" name="str_proc" maxlength="20" size="20" onKeyPress="return txtBoxFormat(document.Form, 'str_proc', '99.999999999/9999-99', event);">
Conta <input type="text" name="str_cc" maxlength="6" size="10" onKeyPress="return txtBoxFormat(document.Form, 'str_cc', '9999-!', event);">
*/
function txtBoxFormat(objForm, strField, sMask, evtKeyPress) {
var i, nCount, sValue, fldLen, mskLen,bolMask, sCod, nTecla;
if(document.all) { // Internet Explorer
nTecla = evtKeyPress.keyCode; }
else if(document.layers) { // Nestcape
nTecla = evtKeyPress.which;
}
sValue = objForm[strField].value;
// Limpa todos os caracteres de formatação que
// já estiverem no campo.
sValue = sValue.toString().replace( "-", "" );
sValue = sValue.toString().replace( "-", "" );
sValue = sValue.toString().replace( ".", "" );
sValue = sValue.toString().replace( ".", "" );
sValue = sValue.toString().replace( "/", "" );
sValue = sValue.toString().replace( "/", "" );
sValue = sValue.toString().replace( "(", "" );
sValue = sValue.toString().replace( "(", "" );
sValue = sValue.toString().replace( ")", "" );
sValue = sValue.toString().replace( ")", "" );
sValue = sValue.toString().replace( " ", "" );

sValue = sValue.toString().replace( " ", "" );
fldLen = sValue.length;
mskLen = sMask.length;
i = 0;
nCount = 0;
sCod = "";
mskLen = fldLen;
while (i <= mskLen) {
bolMask = ((sMask.charAt(i) == "-") || (sMask.charAt(i) == ".") || (sMask.charAt(i) == "/"))
bolMask = bolMask || ((sMask.charAt(i) == "(") || (sMask.charAt(i) == ")") || (sMask.charAt(i) == " "))
if (bolMask) {
sCod += sMask.charAt(i);
mskLen++; }
else {
sCod += sValue.charAt(nCount);
nCount++;
}
i++;
}
objForm[strField].value = sCod;
if (nTecla != 8) { // backspace
if (sMask.charAt(i-1) == "9") { // apenas números...
return ((nTecla > 47) && (nTecla < 58)); } // números de 0 a 9
else { // qualquer caracter...
return true;
} }
else {
return true;
}
}
//Fim da Função Máscaras Gerais
</script>
<?
  //Chama o arquivo abaixo e executa seu conteúdo
  include "Conf_Conect.inc";
  
  //Define a variável que contem o nome do Banco de Dados e da tabela
  $banco="Cred";
  $tabela="Participantes";

  //Define a tabela a ser usada
  mysql_select_db($banco, $conexao);

  //Gera a auto numeracao do codigo
  $query=mysql_query("SELECT * FROM $tabela order by Codigo", $conexao);
  //Pega a quantidade de registros que foram selecionados na tabela
  $Codigo = mysql_affected_rows($conexao);
  //Se não tiver registros é o 1º Registro
  if ($Codigo==0)
     $Codigo = 1;
  else
  //Senão incrementa o Código
     $Codigo++;
	?>
	<html><body>
	<form name='Dados' method='Post'>
  <input type='text' name='txtCodigo' value='<? echo($Codigo);?>'>
	</form>
	</body></html>
	<script Language='JavaScript'>
  //Monta o codigo no Formato 999999
    vVal = document.Dados.txtCodigo.value;
  if (vVal.length == 1)
    	document.Dados.txtCodigo.value = '00000' + vVal;
  	else
  	if (vVal.length == 2)
    document.Dados.txtCodigo.value = '0000' + vVal;
  	else
    if (vVal.length == 3)
    	document.Dados.txtCodigo.value = '000' + vVal;
    else
    if (vVal.length == 4)
    	document.Dados.txtCodigo.value = '00' + vVal;
    else
    	if (vVal.length == 5 )
      document.Dados.txtCodigo.value = '0' + vVal;
	</script>
	<?
  //Tira espaços em branco dos valores e Pega os Valores
	$Categoria = 'Visitante';
	$Cpf = trim($HTTP_POST_VARS['txtCpf']);
  $Cpf = str_replace(".", "", $Cpf);
  $Cpf = str_replace("-", "", $Cpf);
	$Nome = trim($HTTP_POST_VARS['txtNome']);
	$NomeCracha = trim($HTTP_POST_VARS['txtNomeCracha']);
	$Email = trim($HTTP_POST_VARS['txtEmail']);
  $Envia = trim($HTTP_POST_VARS['txtEnvia']);
	$Empresa = trim($HTTP_POST_VARS['txtEmpresa']);
	$Cnpj = trim($HTTP_POST_VARS['txtCnpj']);
  $Cnpj = str_replace(".", "", $Cnpj);
  $Cnpj = str_replace("-", "", $Cnpj);
  $Cnpj = str_replace("/", "", $Cnpj);
	$Cargo = trim($HTTP_POST_VARS['txtCargo']);
	$HomePage = trim($HTTP_POST_VARS['txtHomePage']);
	$QEnd = trim($HTTP_POST_VARS['txtqEnd']);
  $Cep = trim($HTTP_POST_VARS['txtCep']);
  $Cep = str_replace("-", "", $Cep);
	$Endereco = trim($HTTP_POST_VARS['txtEndereco']);
	$Numero = trim($HTTP_POST_VARS['txtNumero']);
	$Complemento = trim($HTTP_POST_VARS['txtComplemento']);
	$Bairro = trim($HTTP_POST_VARS['txtBairro']);
	$Cidade = trim($HTTP_POST_VARS['txtCidade']);
	$Estado= trim($HTTP_POST_VARS['txtEstado']);
	$Pais = trim($HTTP_POST_VARS['txtPais']);
	$DDI_T = trim($HTTP_POST_VARS['txtDDI_T']);
	$DDD_T = trim($HTTP_POST_VARS['txtDDD_T']);
	$Telefone = trim($HTTP_POST_VARS['txtTelefone']);
  $Telefone = str_replace("-", "", $Telefone);
	$DDI_F = trim($HTTP_POST_VARS['txtDDI_F']);
	$DDD_F = trim($HTTP_POST_VARS['txtDDD_F']);
	$Fax = trim($HTTP_POST_VARS['txtFax']);
  $Fax = str_replace("-", "", $Fax);
  $DDI_C = trim($HTTP_POST_VARS['txtDDI_C']);
	$DDD_C = trim($HTTP_POST_VARS['txtDDD_C']);
	$Celular = trim($HTTP_POST_VARS['txtCelular']);
  $Celular = str_replace("-", "", $Fax);
	//Grava a data no padrão aaaa/mm/dd, tem q gravar assim por causa o mysql
  $Data_Inclusao = date('Y/m/d');
  $Evento = 'Primeiro Evento';

  //Lista dos campos e seus valores
	$campos = 'Codigo,Categoria,Cpf,Nome,NomeCracha,Email,Envia,Empresa,Cnpj,Cargo,HomePage,QEnd,Cep,Endereco,Numero,Complemento,Bairro,Cidade,Estado,Pais,DDI_T,DDD_T,Telefone,DDI_F,DDD_F,Fax,DDI_C,DDD_C,Celular,Data_Inclusao,Evento';
	$valores = "'$Codigo','$Categoria','$Cpf','$Nome','$NomeCracha','$Email','$Envia','$Empresa','$Cnpj','$Cargo','$HomePage','$QEnd','$Cep','$Endereco','$Numero','$Complemento','$Bairro','$Cidade','$Estado','$Pais','$DDI_T','$DDD_T','$Telefone','$DDI_F','$DDD_F','$Fax','$DDI_C','$DDD_C','$Celular','$Data_Inclusao','$Evento'";
	//Query de Inserção
	$query = "INSERT INTO $tabela ($campos) VALUES ($valores)";

  //Testa se a query foi executada com sucesso
  if (mysql_db_query($banco,$query,$conexao))
  {
     ?>
   <script LANGUAGE="JavaScript">
    	//window.opener = window
  	//window.close("#")
    //Abre Pop-Up com a Pagina de Inscrição Concluída !
    //Define as Variaveis
  	var w = 400;
  	var h = 400;
  	var winl = (screen.width - w) / 2;
  	var wint = (screen.height - h) / 2;
  	var URL = 'Insc_Concluida.php?';
  	//Abre a Janela
  	win = window.open(URL+document.Dados.txtCodigo.value,'nomedajanela', "width='+w+', height='+h+', top=200, left=300, scrollbars=no, status=no, toolbar=no, location=no, directories=no, menubar=no, resizable=no, fullscreen=no");
  	//Coloca o Foco na Janela Aberta
    if (parseInt(navigator.appVersion) >= 4)
    {
    	win.window.focus();
    }
  	</script>
  <?
  }
  else
	{
     echo "Registro não pode ser incluído !<br>";
     echo "Anote o Erro abaixo e contate o Administrador !<br>";
   echo "<font color = 'red'><b>"; mysql_error();
	}
  //Finaliza a Conexao
  mysql_close($conexao);
?>

eu preciso pegar o valor da txtCodigo, porque eu estou gravando na tabela o valor da variavel $Codigo q tem o valor = 1 e tenho q gravar a txtCodigo tem 000001 entendeu ???

so q eu não consigo pegar o valor da txtCodigo

já tentei assim

$Variavel = $txtCodigo;

esta errado ???

valeu

Link para o comentário
Compartilhar em outros sites

  • 0
Guest Visitante

Quando faço meus formularios coloco

$Variavel = $_POST['name do campo']

ex:

$nome = $_POST['txt_nome'];

+ isso serve pra html+php n sei se javascript é o mesmo

Link para o comentário
Compartilhar em outros sites

Participe da discussão

Você pode postar agora e se registrar depois. Se você já tem uma conta, acesse agora para postar com sua conta.

Visitante
Responder esta pergunta...

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emoticons são permitidos.

×   Seu link foi incorporado automaticamente.   Exibir como um link em vez disso

×   Seu conteúdo anterior foi restaurado.   Limpar Editor

×   Você não pode colar imagens diretamente. Carregar ou inserir imagens do URL.



  • Estatísticas dos Fóruns

    • Tópicos
      152,2k
    • Posts
      652,1k
×
×
  • Criar Novo...