Jump to content
php.lv forumi

Kas Te Nav Pareizi?


Uldeens

Recommended Posts

Forma:

 

<form action="text.php" method="post">

 

<b>e-pasts:</b><input type="text" name="epasts"><br>

<br>

 

<b>Segvards:</b><input type="text" name="segvards"><br>

<br>

 

<input type="textfield" name="teksts"><br>

<br>

 

<input type="submit" value="Nosutit">

 

</form>

 

 

Skripts:

<? php

 

$file="fails.txt";

 

$file= fopen("fails.txt","w+"); //Fails kuraa rakstiis datus

 

fwrite($file, "$teksts"); //Teksts ko ieraksta

 

fclose($file); //Aizver failu

?>

Link to comment
Share on other sites

nu iespeejams tev jaalieto $_POST[teksts], jo serverim globaalie offZ. ieteiktu rakstiit shitaa :

<code><font color="#000000">

<font color="#0000CC"><?
$dati </font><font color="#006600">= </font><font color="#CC0000">'epasts:' </font><font color="#006600">. (</font><font color="#0000CC">$_POST</font><font color="#006600">[</font><font color="#0000CC">epasts</font><font color="#006600">]) . </font><font color="#CC0000">'segvards:' </font><font color="#006600">. (</font><font color="#0000CC">$_POST</font><font color="#006600">[</font><font color="#0000CC">segvards</font><font color="#006600">]) . </font><font color="#CC0000">'teksts:' </font><font color="#006600">. (</font><font color="#0000CC">$_POST</font><font color="#006600">[</font><font color="#0000CC">teksts</font><font color="#006600">]) </font><font color="#CC0000">'<br />'</font><font color="#006600">;
</font><font color="#0000CC">$file</font><font color="#006600">= </font><font color="#0000CC">[url=http://lv.php.net/fopen]fopen[/url]</font><font color="#006600">(</font><font color="#CC0000">"fails.txt"</font><font color="#006600">,</font><font color="#CC0000">"w+"</font><font color="#006600">); </font><font color="#FF9900">//Fails kuraa rakstiis datus
</font><font color="#0000CC">[url=http://lv.php.net/fwrite]fwrite[/url]</font><font color="#006600">(</font><font color="#0000CC">$file</font><font color="#006600">, </font><font color="#0000CC">$dati</font><font color="#006600">); </font><font color="#FF9900">//Teksts ko ieraksta
</font><font color="#0000CC">[url=http://lv.php.net/fclose]fclose[/url]</font><font color="#006600">(</font><font color="#0000CC">$file</font><font color="#006600">); </font><font color="#FF9900">//Aizver failu
</font><font color="#0000CC">?>
</font>
</font>
</code>

Link to comment
Share on other sites

Nee Jonass man tie globaalie on..

 

Bet vins man visulaiku arii manaa variantaa met araa kluudu :Parse error: parse error in c:program fileseasyphpwwwtext.php on line 5

 

kautkas ar to fwrite..

Link to comment
Share on other sites

Nu manuprat kljuda ir citur...

tavs kods:

$file="fails.txt";

 

$file= fopen("fails.txt","w+"); //Fails kuraa rakstiis datus

 

fwrite($file, "$teksts"); //Teksts ko ieraksta

 

fclose($file); //Aizver failu

?>

 

mans kods:

$file="fails.txt";

$open=fopen("$file", "w+");

fputs ($open, "$texts");

fclose ($open) or die("kaut kas ir garaam!");

Vismaz man rukaaa...

Link to comment
Share on other sites

Paldies DelNet tiesaam aizgaaja.Tur parasti ir probleema ka kads ierauga ka

nav kautkur komata vai HVZ un raksta kaapeec neiet,Paldies kad uzrakstiiji paarbaudiitu lietu. ;)

Link to comment
Share on other sites

Palidzeet ivener laipni!!! Es patiesibaa esmu tuvaka ticis php jomaa nekaa Tu uldeen. Vismaz es ta domaaju, jo neko par db nezinu :) php no manualjiem lasijies, gribejaas jau kadu kaut via to pashu php soli pa solim palasiit, bet nav iespeju.... nu neko dariit dzivojam kaa varam... vispaar peec dabad esmu arii slinks... bet logjiskaa domashana man ir augsta kvalitatee, fizikas formulas nezinu nevienu - nekad nemsu tas macijies, bet kad ir kontroldarbs, tad visu logiski izdomajot tiekma pie iznakuma...formulu nezinaam iznakumu gan :)

Piekritu fassko, ja pats atklaj kljuud tad ir labaak un veidojas kaut kaads lielaks experience...

Link to comment
Share on other sites

A kaapeec nav iespeju lassit PHP SOLI pa SOLIM?

 

Robi pareizi man jau arii orginaalaa staav texarea vienkaarsi forumaa no galvas to piemeeru rakstiiju.

 

Manliekas graamataa lasiiju ka DB vienaa shuunaa var buut tikai 255 simboli :blink: . taa ir taisniiba??? Tad jau sanaak ja postee garaakus tekstus tad tie jaaliek texta failaa(kas savukaart ir porno no mana viedokla jo db man vismaz irakstiit un nolasiit izdevaas).

Link to comment
Share on other sites

×
×
  • Create New...