Web Development Logs
Find articles, news and reviews about latest technologies.


Welcome Guest !
please login or register a new free account.


Home | Archives | Submit Article | Top Rated | Advance Search | Contacts Us | Rss Feeds

    Main Categories
» Free downloads
» General Blog
» Google Adsense
» Scripting languages
» Search Engines
» Web Designing

  More Options
» Most read articles
» Most rated articles

   Subscription
Subscribe now and receive free articles and updates instantly.
» Your name » Your Email

titles description    advance search
Published : April 29, 2006 | Author : Ali Roman
Category : Scripting languages | Total Views : 5375 | Rating :

  

In above example you have learned how to use an Input Box and how to get data into Dynamic Text box. We have sent data from Input Text box to Dynamic Text Box.

Dwonload Example File

UNDERSTANDING - HOW TO SEND DATA TO TEXT FILE FROM INPUT BOX
-----------------------------------------------------------------------------
Now I assume that you can understand how Input and Dynamic TEXT works. So here we go. You must also undestand how varialbes work, if you dont know then please read this Variable Tutorial and this Tutorial..For more details on how it work with PHP, Read this tutorial...

Steps for making an example which sends data to a text file.
--------------------------------------------------------------------

1. Make a text box and select its type as Input Box. In its Name type inputName. Check the box of target. In variable box use any name for example inputVar. Now inputVar is the variable which will carry the data you will input in this box. Click on the button for multiline.

2. Make a text file with notepad and write &myDynamicVar=This is my text.

3. Again open notepad paste the following code in it and save it as myphpfile.php

chmod("mytextfile.txt",0666);
$f=fopen("mytextfile.txt","w");
fwrite($f,"&myDynamicVar=$inputVar");
fclose($f);
chmod("mytextfile.txt",0600);
?>


4. Make a button "Save" and on its action paste the following code.

on (release) {
this.loadVariables("myphpfile.php",'POST');
}

Download Example File

EXPLANATION of PHP FILE
----------------------------
There are 7 lines in myphpfile.php

1. 2. chmod("mytextfile.txt",0666);
3. $f=fopen("mytextfile.txt","w");
4. fwrite($f,"&myDynamicVar=$inputVar");
5. fclose($f);
6. chmod("mytextfile.txt",0600);
7. ?>

 
What is on line 1 " ?
This is PHP synatx used to start PHP code, as we use Begin keyword in Pascal and { in C,C++.
 
What is on line 2 "chmod("mytextfile.txt",0666);"
This is code which will automatically change te permission of text file, so that you are able to write
data into it.
What is on line 3 "$f=fopen("mytextfile.txt","w");"
Here we have made a new variable $f and we have assign it a value fopen("mytextfile.txt","w"). Now fopen is a PHP function which open any file for different purposes, for example we are opening text file to write data into it, thats why we have used "w" infront of it. If we want to append any file we will use "a".
 
What is on line 4 "fwrite($f,"&myDynamicVar=$inputVar");"
fwrite is the function which write data to file, in its first argument you have passed the variavble "$f" which is opening text file in line 3, in second agrument I have used "&myDynamicVar=$inputVar".
 
What is on line 5 "fclose($f);"
You will have to close file which you have opend for any purpose.
 
What is on line 6 "chmod("mytextfile.txt",0600);"
We have again changed the file permission so that no one else can write any data externally.
 
What is on line 7 "?>"
This is closing syntax for a PHP file.
 
You are done. Upload your files and check on the server which supports PHP Scripts. You dont need to chmod any file. I hope it helps :)
 
best reagrds
- Ali Roman..


Pages : 1 [ 2 ]


1 2 3 4 5
please rate this article     Poor
Excellent    
Most viewed articles in Scripting languages category

Retrieving data from MySQL database using php
Creating simple contact form using swishmax and php
Creating dynamic combo list with PHP and MySQL
Creating simple percentage preloader with swishmax
Saving data to a text file with swishmax and php
Most recent articles in Scripting languages category

Saving data to a text file with swishmax and php
Creating dynamic combo list with PHP and MySQL
Retrieving data from MySQL database using php
Establishing connection with MySQL using php
Creating table using MySQL database

 Visitor's Comments !

there are no comments...


    Random Pick
For making your Visual Basic projects more attracitve by embedding flash made Movies (swf based). Lets make a simple example have simple animations. You cn find the source code as well, which can help you develop something vrey interesting.

    Statistics
» Total Articles
74
» Total Authors
103
» Total Views
123991
» Total categories
6

Delete cookies set by this site | Top   

Article Manager by Flaxweb
Copyright 2006 © Flax Article Manager v1.1