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

passar variaveis por parametro


edersonnves

Pergunta

pessoal estou criando um formulario onde o usuario digita a quantidade pacientes, ou seja ao digitar 2 por exemplo e criado dois formulario para paciente até ai tudo bem, fiz isso usando o comando for so que ao clicar no botão submit do outro lado da erro segue abaixo como eu fiz

aqui nessa pagina e o formulario onde o usuario digita a quantidade que vai querer

<html>

<head>

<title>

Montagem de BO paciente

</title>

<body>

<form action = 'bo_paciente.php' method = 'post'><br>

Quantidade de paciente: <input name='qtd_pac' type = 'numero' size= 4 value = 1>

Quantidade de Testemunha: <input name='qtd_test' type = 'numero' size =4 value = 2><br><br>

<input type='reset' value='Limpar dados' name='limpar'>

<input type='submit' value='Montar BO' name = 'enviar'>

</form>

</body>

</html>

aqui nessa outra pagina é onde consta os dados do paciente, ou seja recebe a quantidade de pacientes e constroi a quantidade solicitada

<?php

for($i=1; $i<= $qtd_pac; $i++){

echo "<fieldset><legend><B>DADOS DO PACIENTE Nº $i </B></legend><br>";

echo "Nome: <input name ='nome_pac[$i]' type=text' size=40>";

echo "Data de nascimento: <input name ='dt_nascimento_pac[$i]' type ='text' size=10>";

echo "Sexo: <input type='radio' name='sexo_pac[$i]' value='maculino' CHECKED> masculino";

echo "<input type='radio' name='sexo_pac[$i]' VALUE='maculino'> feminino<br><br>";

echo "Nome da Mãe: <input name ='nome_mae_pac[$i]' type ='text' size=40>";

echo " Nome do Pai: <input name ='nome_pai_pac[$i]' type ='text' size=40> <br><br>";

echo "Endereço: <input name = 'endereco_pac[$i]' type ='text' size=60>";

echo " Complemento: <input name = 'compl_pac[$i]' type = 'text' size=30> <br><br>";

echo "Bairro: <input name = 'bairro_pac[$i]' type = 'text' size =15>";

echo " Cidade: <input name = 'cidade_pac[$i]' type = 'text' size =15>";

echo " Estado: <input name = 'estado_pac[$i]' type = 'text' size =15>";

echo " Telefone: <input name = 'tel_pac[$i]' type = 'text' size =15> <br><br>";

echo "Tipo de Documento: <input name = 'tipo_doc_pac[$i]' type='text' size=20> ";

echo " Numero: <input name = 'numero_doc_pac[$i]' type = 'text' size=10> ";

echo " Orgão Expedidor: <input name = 'orgao_exp_pac[$i]' type='text' size=10> ";

echo " UF: <input name = 'uf_pac[$i]' type = 'text' size = 2><br>";

echo "</fieldset><br>";

}

é aqui nessa pagina que dar o erro ao clica no botao submit esses dados que era para receber os valores que foram digitados. dao erro

?>

for($i=1; $i<= $qtd_pac; $i++){

$nome[$i] = $_POST["nome_pac[$i]];

$data_nascimento[$i] = $_POST["dt_nascimento_pac[$i]"];

$sexo_pac[$i] = $_POST["sexo_pac[$i]"];

$nome_mae[$i] = $_POST["nome_mae_pac[$i]"];

$nome_pai[$i] = $_POST["nome_pai_pac[$i]"];

$endereco[$i] = $_POST["endereco_pac[$i]"];

$complemento[$i] = $_POST["compl_pac[$i]"];

$bairro[$i] = $_POST["bairro_pac[$i]"];

$cidade[$i] = $_POST["cidade_pac[$i]"];

$estado[$i] = $_POST["estado_pac[$i]"];

$telefone[$i] = $_POST["tel_pac[$i]"];

$tipo_doc[$i] = $_POST["tipo_doc_pac[$i]"];

$numero_doc[$i] = $_POST["numero_doc_pac[$i]"];

$orgao_exp[$i] = $_POST["orgao_exp_pac[$i]"];

$uf[$i] = $_POST["uf_pac[$i]"];

}

?>

esse é o erro

Notice: Undefined index: nome_pac[1] in C:\Arquivos de programas\Apache Software Foundation\Apache2.2\htdocs\rl_paciente.php on line 35

Notice: Undefined index: dt_nascimento_pac[1] in C:\Arquivos de programas\Apache Software Foundation\Apache2.2\htdocs\rl_paciente.php on line 36

Notice: Undefined index: sexo_pac[1] in C:\Arquivos de programas\Apache Software Foundation\Apache2.2\htdocs\rl_paciente.php on line 37

Notice: Undefined index: nome_mae_pac[1] in C:\Arquivos de programas\Apache Software Foundation\Apache2.2\htdocs\rl_paciente.php on line 38

Notice: Undefined index: nome_pai_pac[1] in C:\Arquivos de programas\Apache Software Foundation\Apache2.2\htdocs\rl_paciente.php on line 39

Notice: Undefined index: endereco_pac[1] in C:\Arquivos de programas\Apache Software Foundation\Apache2.2\htdocs\rl_paciente.php on line 40

Notice: Undefined index: compl_pac[1] in C:\Arquivos de programas\Apache Software Foundation\Apache2.2\htdocs\rl_paciente.php on line 41

Notice: Undefined index: bairro_pac[1] in C:\Arquivos de programas\Apache Software Foundation\Apache2.2\htdocs\rl_paciente.php on line 42

Notice: Undefined index: cidade_pac[1] in C:\Arquivos de programas\Apache Software Foundation\Apache2.2\htdocs\rl_paciente.php on line 43

Notice: Undefined index: estado_pac[1] in C:\Arquivos de programas\Apache Software Foundation\Apache2.2\htdocs\rl_paciente.php on line 44

Notice: Undefined index: tel_pac[1] in C:\Arquivos de programas\Apache Software Foundation\Apache2.2\htdocs\rl_paciente.php on line 45

Notice: Undefined index: tipo_doc_pac[1] in C:\Arquivos de programas\Apache Software Foundation\Apache2.2\htdocs\rl_paciente.php on line 46

Notice: Undefined index: numero_doc_pac[1] in C:\Arquivos de programas\Apache Software Foundation\Apache2.2\htdocs\rl_paciente.php on line 47

Notice: Undefined index: orgao_exp_pac[1] in C:\Arquivos de programas\Apache Software Foundation\Apache2.2\htdocs\rl_paciente.php on line 48

Notice: Undefined index: uf_pac[1] in C:\Arquivos de programas\Apache Software Foundation\Apache2.2\htdocs\rl_paciente.php on line 49

Notice: Undefined index: nome_pac[2] in C:\Arquivos de programas\Apache Software Foundation\Apache2.2\htdocs\rl_paciente.php on line 35

Notice: Undefined index: dt_nascimento_pac[2] in C:\Arquivos de programas\Apache Software Foundation\Apache2.2\htdocs\rl_paciente.php on line 36

Notice: Undefined index: sexo_pac[2] in C:\Arquivos de programas\Apache Software Foundation\Apache2.2\htdocs\rl_paciente.php on line 37

Notice: Undefined index: nome_mae_pac[2] in C:\Arquivos de programas\Apache Software Foundation\Apache2.2\htdocs\rl_paciente.php on line 38

Notice: Undefined index: nome_pai_pac[2] in C:\Arquivos de programas\Apache Software Foundation\Apache2.2\htdocs\rl_paciente.php on line 39

Notice: Undefined index: endereco_pac[2] in C:\Arquivos de programas\Apache Software Foundation\Apache2.2\htdocs\rl_paciente.php on line 40

Notice: Undefined index: compl_pac[2] in C:\Arquivos de programas\Apache Software Foundation\Apache2.2\htdocs\rl_paciente.php on line 41

Notice: Undefined index: bairro_pac[2] in C:\Arquivos de programas\Apache Software Foundation\Apache2.2\htdocs\rl_paciente.php on line 42

Notice: Undefined index: cidade_pac[2] in C:\Arquivos de programas\Apache Software Foundation\Apache2.2\htdocs\rl_paciente.php on line 43

Notice: Undefined index: estado_pac[2] in C:\Arquivos de programas\Apache Software Foundation\Apache2.2\htdocs\rl_paciente.php on line 44

Notice: Undefined index: tel_pac[2] in C:\Arquivos de programas\Apache Software Foundation\Apache2.2\htdocs\rl_paciente.php on line 45

Notice: Undefined index: tipo_doc_pac[2] in C:\Arquivos de programas\Apache Software Foundation\Apache2.2\htdocs\rl_paciente.php on line 46

Notice: Undefined index: numero_doc_pac[2] in C:\Arquivos de programas\Apache Software Foundation\Apache2.2\htdocs\rl_paciente.php on line 47

Notice: Undefined index: orgao_exp_pac[2] in C:\Arquivos de programas\Apache Software Foundation\Apache2.2\htdocs\rl_paciente.php on line 48

Notice: Undefined index: uf_pac[2] in C:\Arquivos de programas\Apache Software Foundation\Apache2.2\htdocs\rl_paciente.php on line 49

Notice: Undefined index: nome_test[1] in C:\Arquivos de programas\Apache Software Foundation\Apache2.2\htdocs\rl_paciente.php on line 72

Notice: Undefined index: dt_nascimento_test[1] in C:\Arquivos de programas\Apache Software Foundation\Apache2.2\htdocs\rl_paciente.php on line 73

Notice: Undefined index: sexo_test[1] in C:\Arquivos de programas\Apache Software Foundation\Apache2.2\htdocs\rl_paciente.php on line 74

Notice: Undefined index: nome_mae_test[1] in C:\Arquivos de programas\Apache Software Foundation\Apache2.2\htdocs\rl_paciente.php on line 75

Notice: Undefined index: nome_mae_test[1] in C:\Arquivos de programas\Apache Software Foundation\Apache2.2\htdocs\rl_paciente.php on line 76

Notice: Undefined index: nome_pai_test[1] in C:\Arquivos de programas\Apache Software Foundation\Apache2.2\htdocs\rl_paciente.php on line 77

Notice: Undefined index: endereco_test[1] in C:\Arquivos de programas\Apache Software Foundation\Apache2.2\htdocs\rl_paciente.php on line 78

Notice: Undefined index: compl_test[1] in C:\Arquivos de programas\Apache Software Foundation\Apache2.2\htdocs\rl_paciente.php on line 79

Notice: Undefined index: bairro_test[1] in C:\Arquivos de programas\Apache Software Foundation\Apache2.2\htdocs\rl_paciente.php on line 80

Notice: Undefined index: cidade_test[1] in C:\Arquivos de programas\Apache Software Foundation\Apache2.2\htdocs\rl_paciente.php on line 81

Notice: Undefined index: estado_test[1] in C:\Arquivos de programas\Apache Software Foundation\Apache2.2\htdocs\rl_paciente.php on line 82

Notice: Undefined index: tel_test[1] in C:\Arquivos de programas\Apache Software Foundation\Apache2.2\htdocs\rl_paciente.php on line 83

Notice: Undefined index: nome_test[2] in C:\Arquivos de programas\Apache Software Foundation\Apache2.2\htdocs\rl_paciente.php on line 72

Notice: Undefined index: dt_nascimento_test[2] in C:\Arquivos de programas\Apache Software Foundation\Apache2.2\htdocs\rl_paciente.php on line 73

Notice: Undefined index: sexo_test[2] in C:\Arquivos de programas\Apache Software Foundation\Apache2.2\htdocs\rl_paciente.php on line 74

Notice: Undefined index: nome_mae_test[2] in C:\Arquivos de programas\Apache Software Foundation\Apache2.2\htdocs\rl_paciente.php on line 75

Notice: Undefined index: nome_mae_test[2] in C:\Arquivos de programas\Apache Software Foundation\Apache2.2\htdocs\rl_paciente.php on line 76

Notice: Undefined index: nome_pai_test[2] in C:\Arquivos de programas\Apache Software Foundation\Apache2.2\htdocs\rl_paciente.php on line 77

Notice: Undefined index: endereco_test[2] in C:\Arquivos de programas\Apache Software Foundation\Apache2.2\htdocs\rl_paciente.php on line 78

Notice: Undefined index: compl_test[2] in C:\Arquivos de programas\Apache Software Foundation\Apache2.2\htdocs\rl_paciente.php on line 79

Notice: Undefined index: bairro_test[2] in C:\Arquivos de programas\Apache Software Foundation\Apache2.2\htdocs\rl_paciente.php on line 80

Notice: Undefined index: cidade_test[2] in C:\Arquivos de programas\Apache Software Foundation\Apache2.2\htdocs\rl_paciente.php on line 81

Notice: Undefined index: estado_test[2] in C:\Arquivos de programas\Apache Software Foundation\Apache2.2\htdocs\rl_paciente.php on line 82

Link para o comentário
Compartilhar em outros sites

1 resposta a esta questão

Posts Recomendados

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
      652k
×
×
  • Criar Novo...