Jump to content
Fórum Script Brasil
  • 0
Sign in to follow this  
Guest Fabio Abrantes

Criação E Leitura De Arquivo Txt

Question

Guest Fabio Abrantes

Peço ajuda!!!

Arquivo para leitura:Lê O arquivo salmo.txt e apresenta na tela:"Funcionando"

<?

if($arquivo = fopen("salmo.txt", "r")){

while(!feof($arquivo)){

$linha = fgets($arquivo, 300);

echo $linha . "<br>";

}

fclose($arquivo);

}

else{

echo "Ops! Algo saiu errado";

}

?>

__________________________________________________________________

Arquivo para gravação do salmo.txt: "Não Funciona"

1) Formulario.php

<form name="form1" method="get" action="index2.php">

<table width="47%" border="0">

<tr>

<td width="10%">salmos</td>

<td width="90%"><input name="salmo" type="text" id="salmo" size="50"></td>

</tr>

</table>

<p>

<input type="submit" name="Submit" value="Enviar">

<input type="reset" name="Submit2" value="Redefinir">

</p>

</form>

___________________________________________________________________

2) action= index2.php (usado para gravar o que for digitado no formulario no arquivo salmo.txt ("não funciona ")

<?

$data = date("d") . "/" . date("m") . "/" . date("Y");

$salmo= $_POST [salmo];

$cadastro= $salmo;

if($arquivo = fopen("salmo.txt", "w")){

fputs($arquivo, $cadastro, $data);

fclose($arquivo);

}

else{

echo "Ops! Algo saiu errado";

}

?>

__________________________________________________________

Alguém tem a misericórdia de decifrar porque não grava?

[email protected]

Share this post


Link to post
Share on other sites

1 answer to this question

Recommended Posts

  • 0

As veses pode ser algo simples...

<form name="form1" method="get" action="index2.php">

index2.php

$salmo= $_POST [salmo];

$cadastro= $salmo;

Tente colocar no form como method -> POST. wink.gif

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  



  • Forum Statistics

    • Total Topics
      148104
    • Total Posts
      643373
×
×
  • Create New...