[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 211
  • Last Modified:

PHP Program

Dear Expert,

My Boss want to create a web-page (PHP) like follow:
1. The Web-Page's out-look design very simple
- Need one Textbox to key-in the data.
- Common button like "Submit"
<<Common Button function>>
"Submit"
- Ex: when user key-in "1000", after click the submit button it will automatically create a text file.
The file name like as follow. "20071002.txt" <-- which depend on the computer date.
Then it will automatically send this file to a FTPS server.

Please help....
0
RickyXC
Asked:
RickyXC
1 Solution
 
ppfoongCommented:

You can do it by yourself. The following tutorial with examples has the answer.

http://www.w3schools.com/php/default.asp

Look into these section:
- PHP forms for the form input.
- PHP date for the date function.
- PHP file for the file opening and writing.


The textbox is called textarea in HTML. To create one, use the following syntax:

<textarea name="area1" rows="5" cols="40"></textarea>

You can adjust the number of rows and columns by changing the figures above.
0
 
RickyXCAuthor Commented:
Dear Expert,

Actually i am not a web-programmer....so i dont have any ideas on it...
Anyone can help me ... Sorry and Thanks 1st...
0
 
siva_sivaCommented:
Hi,

Below code create the file name as current date on system and write the value given in the text box.

text.php
#######
<?php      
      if(isset($_POST['submit'])) {
            $date = date("m/d/Y");
            $date_array = explode("/", $date);
            $writedata = $_POST['key-in'];
            $ourFileName = "$date_array[2]$date_array[0]$date_array[1].txt";
            $ourFileHandle = fopen($ourFileName, 'w') or die("can't open file");
            fwrite($ourFileHandle, $writedata);
            fclose($ourFileHandle);
      }      
?>
<form name="fileform" action="text.php" method="post">
<table>
      <tr>
            <td><input type="text" name="key-in" value=""></td>
      </tr>
      <tr>
            <td><input type="submit" name="submit" value="Submit"></td>
      </tr>
</table>
</form>
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now