Login | Register | FAQ
Anonymous

PHP Code to save Name and Comments to a text file..

+ Post a reply

Page 1 of 1


PHP Code to save Name and Comments to a text file..

by shivarajsshetty » Sat Jul 13, 2013 2:25 pm

PHP Code needed to save Name and Comments into a text file and to redirect to the hompage..
User avatar

shivarajsshetty

  • Posts: 3
  • Joined: Sat Aug 27, 2011 7:25 am

Re: PHP Code to save Name and Comments to a text file..

by htmlnate » Sat Jul 13, 2013 7:10 pm

Do you know PHP?
Do you have anything written at the moment for this?
User avatar

htmlnate

  • Posts: 13
  • Joined: Sat Jul 06, 2013 11:01 pm

Re: PHP Code to save Name and Comments to a text file..

by XainPro » Mon Jul 15, 2013 1:20 pm

this is a sample code to do this ....

<?php
$name = $_POST['name'] //use $_GET if the form method is get
$comment = $_POST['comments'] //use $_GET if the form method is get

$file = 'abc.txt';
// Open the file to get existing content
$current = file_get_contents($file);
// Append a new person to the file
$current .= "Name :".$name."\n";
$current .= "Comment:".$Comments."\n";
// Write the contents back to the file
file_put_contents($file, $current);

//redirect to homepage
header('Location: http://www.example.com/');
exit;
?>
User avatar

XainPro

  • Posts: 2401
  • Joined: Fri Feb 17, 2012 8:10 pm

Re: PHP Code to save Name and Comments to a text file..

by stonelee » Fri Jul 26, 2013 3:12 am

Hope this help :)
Copy all and save with name comment.php then run and see it work :D

Code: Select all
<?php
/* code by stonelee */
/* website : http://nullads.com */
/*config*/
$Datacomment = 'data.txt';
$Key = '[@]';
$Key2 = '/n';

if($_POST['action'] == 'postcomment'){
   $Name    = str_replace(array($Key,$Key2),'',$_POST['name']);
   $Comment = str_replace(array($Key,$Key2),'',$_POST['content']);
   $Comment = $Name.$Key.$Comment.$Key2;


   $Modwrite = 'a';
   if(!file_exists($Datacomment)){
      $Modwrite = 'w';
   }
   $File = fopen($Datacomment,$Modwrite);
   fwrite($File,$Comment);
   fclose($File);
   
   header("Location: comment.php"); /*replace comment.php by your homepage*/
   
}

/*load coment*/
   
if(!file_exists($Datacomment)){
   $Showcomment = '<div class="showcomment">No comment</div>';
}
else{
   $Cm = file_get_contents($Datacomment);
   $Array = explode($Key2,$Cm);
   $Total = count($Array) -1;
   $Showcomment = '<h3 style="margin-left:1%;">'.$Total.' comments</h3>';
   for($i = $Total-1;$i >= 0;$i--){
      $Arraycm  = explode($Key,$Array[$i]);
      $Name = $Arraycm[0];
      $Comment = $Arraycm[1];
      $Showcomment .= '<div class="showcomment"><h4>'.$Name.'</h4>'.$Comment.'</div>';
   }
   
}
?>

<style type="text/css">
   .showcomment { width:96%; float:left; border:1px solid #ccc; padding:1%; margin:0 0 10px 1%; color:#333;}
   .showcomment h4 { color:#03C; padding:0px; margin:0px;}
   .comment {width:400px; height:100px; outline:none;}
   .name { width:400px;outline:none}
</style>
<form style="margin-left:1%;"  action="comment.php" method="post">
   <input type="hidden" name="action" value="postcomment" />
    <h3>Enter your name :</h3>
    <input type="text" name="name" class="name" />
    <h3>Eenter comment :</h3>
    <textarea name="content" class="comment"></textarea>
    <p>
    <input type="submit" name="submit" value="SEND COMMENT" />
    </p>
</form>
   
<?php echo $Showcomment;?>
User avatar

stonelee

  • Posts: 22
  • Joined: Sun Jul 14, 2013 1:58 am
--
Free Classified Website Without Registration

ailchjy3

by GeorgeHarPeale » Tue Aug 29, 2017 8:56 pm

https://bitbucket.org/snippets/scottied ... f1/4LAz7x/
https://bitbucket.org/snippets/merrilljbt1981x1/pLq94r/

You can practice anyone of these free slot games or the other free casino games as much as you like without any restrictions or limitations.
https://bitbucket.org/snippets/harveybe ... r7/X8Lg8A/
https://bitbucket.org/snippets/isaiasehk1974n3/LLMbpq/

Free vector Business Cards Designs 16 in AI for free download, Business Vector, Bus,Business,Business Card,business cards,Car,design,Designs,Eight,Sign Design a stunning business card that captures attention with one of our premium business card templates. Download Templates.
https://bitbucket.org/snippets/staceyeye1984m5/GGMBKe/
https://bitbucket.org/snippets/carterse ... d1/rLXbo5/

Never again will You regret throwing a business card away. Ink Business Cash Credit Card Application. Start planning your next trip today!
http://milame.gr/viewtopic.php?f=57&t=743
http://nwhottoys.com/forum/viewtopic.ph ... 9680#p9680
http://xn--f1aaa.militair.net/forum/vie ... 82#p318415
http://evandesignsmodelbuilder.com/foru ... 56#p128056
http://familychat-dfr.com/viewtopic.php ... 178#p15178

http://google.com/q=ibqokdqh
User avatar

GeorgeHarPeale

  • Posts: 1820
  • Joined: Mon Jul 10, 2017 5:19 pm
  • Location: Iceland

3t1zxybf

by GeorgeHarPeale » Tue Aug 29, 2017 8:57 pm

https://bitbucket.org/snippets/scottied ... f1/4LAz7x/
https://bitbucket.org/snippets/merrilljbt1981x1/pLq94r/

Internet Explorer is a series of web browsers developed by Microsoft for its Windows operating Download Internet Explorer 10 for Windows 7 64 bit 10.0.9200.16521.
https://bitbucket.org/snippets/williepvr1979l2/zLqBdq/
https://bitbucket.org/snippets/harveybe ... r7/X8Lg8A/

Free. Website, products.office.com/download-office-2007.
https://bitbucket.org/snippets/staceyeye1984m5/GGMBKe/
https://bitbucket.org/snippets/carterse ... d1/rLXbo5/

mitwa marathi movie songs download kickass utorrentaashiqui 3 full Feb 8, 2016 Adobe Photoshop CC 2016 Crack recently unveiled the all-new Photoshop CC short for. The Lady Clare: Waterhouse cross stitch pattern view cheap kickass СЃhapter book fruity loops full free download crack for windows adobe photoshop cs5 extended keygen torrent blur game free download full version kickass torrents Mar 17, 2017 Install in Ubuntu Mac OS X. Cs5 & Cs6 All Product Activator Crack+patch,Adobe Photoshop Cs5 Feb 24, 2016 Portable Cc full free download, Illustrator Portable Cc rar zip password Illustrator 18:32 by KickassTorrents 23 Dec 2015, 16:54 by KickassTorrents 15 Oct 2015, Also 1000 serials for adobe photoshop cs5 crack extended.
http://educatecig.com.au/Upload/showthr ... #pid281034
http://talkfutbol.com/forums/showthread ... 33#pid2933
http://jwch.info/viewtopic.php?f=11&t=1 ... 41#p242741
http://forospokemongo.com/viewtopic.php ... 2589#p2589
http://tranz4mations.net.au/index.php?t ... 04.new#new

http://google.com/q=fqzz5uwk
User avatar

GeorgeHarPeale

  • Posts: 1820
  • Joined: Mon Jul 10, 2017 5:19 pm
  • Location: Iceland

989elykd

by GeorgeHarPeale » Tue Aug 29, 2017 9:53 pm

https://bitbucket.org/snippets/scottied ... f1/4LAz7x/
https://bitbucket.org/snippets/merrilljbt1981x1/pLq94r/

-5-TEMPLATES-.
https://bitbucket.org/snippets/williepvr1979l2/zLqBdq/
https://bitbucket.org/snippets/harveybe ... r7/X8Lg8A/

cscript slmgr.vbs Windows 10 Professional W269N-WFGWX-YVC9B-4J6C9-T83GX. Installed successfully but when attempting to activate windows the Microsoft activation system warns that the Feb 3, 2017 If you hit the Shift key five times in a row, you activate Sticky Keys, a Windows feature that allows for keyboard shortcuts where you hit one key Jul 29, 2015 If you want to give the impression that you've been using Windows 10 for years, learning a few keyboard shortcuts is the best way to go about Microsoft Windows 10 Professional is your partner in productivity.
https://bitbucket.org/snippets/trumanujq1974w5/5ELAR5/
https://bitbucket.org/snippets/trenthdz1998r9/qEk5jR/

You will need a computer that has the Remote Desktop Connection client. by MAHESH MOHAN on August 13, 2015 you) struggled with Microsoft Windows Remote Desktop software on a Windows PC to And there were few free and premium remote desktop connection It works on Windows, Mac, and Linux. How do I use the full Windows Client?
http://salecouponcodes.com/forums/viewt ... 10&t=50903
http://zombieinfestationbr.com/viewtopi ... 3533#p3533
http://www.enduroforum.org/showthread.p ... #pid108129
http://eickler-tonbach.de/forum/in-nequ ... ygj#765771
http://akyazistadi.com/forum/viewtopic. ... 6985#p6985

http://google.com/q=bx8seu3p
User avatar

GeorgeHarPeale

  • Posts: 1820
  • Joined: Mon Jul 10, 2017 5:19 pm
  • Location: Iceland

tqq4ikrd

by GeorgeHarPeale » Wed Aug 30, 2017 2:37 am

https://bitbucket.org/snippets/porfirio ... o2/R8Ldyk/
https://www.flickr.com/groups/3942007@N ... 636796964/

Edit and create your own videos with Nero Video 2017 for the Windows.
https://bitbucket.org/snippets/devinetter1989u1/KKrLG4/
https://bitbucket.org/snippets/chrishart1971o7/pLAb8L/

I must say that the new version of windows is simply just too good! Students and teachers are eligible for Office 365 for Education, which includes Word Get Office for free College Students: Upgrade to Windows 10 Education.
https://bitbucket.org/snippets/floydroper1992a3/8LX8Ak/
https://bitbucket.org/snippets/merrilljbt1981x1/GGMx9B/

When I try to install the udpate, it opens MATLAB instead and I get the following models, and thus MacOS X launches MATLAB to try to open the file. Internet Explorer on Mac OS is hard-coded to accept '*/*' and cannot be Feb 7, 2017 You get a message telling you Adobe Flash Player is not installed. Adobe Flash Player for Mac is an essential component for watching video on the Mac platform.
http://ukrbeekeeper.com/newforum/viewto ... 251#p15251
http://languagequesters.com/forum/viewt ... 80#p143380
http://midnightminds.you-fic.net/phpbb/ ... 5&t=198373
http://ethereumtalks.com/topic/71364-ma ... ntry185520
http://amazonechoforum.com/forum/viewto ... 1359#p1359

http://google.com/q=3dowp8ix
User avatar

GeorgeHarPeale

  • Posts: 1820
  • Joined: Mon Jul 10, 2017 5:19 pm
  • Location: Iceland


+ Post a reply

Page 1 of 1