Hi, Well. As title says it self. I have got one xdb.txt file as database x.php as php processor. NOW i will write a small code to make you understand what i want; PHP Code: <?php $dbname="xdb.txt" ?> <html> <head> <title>X FILE,</title> </head> <body> <form method="post" action="x.php"> <input name="text" type="text" size="15"> <input name="submit" type="submit" value="SUBMIT!"> </form> </body> </html> PHP: NOW, what i want here is in text field "text", If some one put a text,message and submit using Submit button. After when the submit process that php script code it writes the value of "text" to our txt database that is xdb.txt. Hope it clears Wink Thanks in advance! FAISAL!
im not sure using text files... but using php and mysql , <?php if ($_POST[submit]){ $textvalue=$_POST[textfiled]; $sql="insert into <table name> set <your field>='$textvalue' "; $query=mysql_query($sql) or die(mysql_error()); echo"inserted"; } ?> PHP: its the basic code ,not complete
<?php if ($_POST[submit]){ $textvalue=$_POST[textfiled]; $myFile = "testFile.txt"; $fh = fopen($myFile, 'w') or die("can't open file"); fwrite($fh, $textvalue); fclose($fh); } ?>
<?php if ($_POST[submit]){ $textvalue=$_POST[textfiled]; $dbname="xdb.txt" $fh = fopen($dbname, 'w') or die("can't open file"); fwrite($fh, $textvalue); fclose($fh); } ?> PHP: