Current location: Hot Scripts Forums » Programming Languages » PHP » [SOLVED] Is there an INPUT TYPE = CREATE FILE?


[SOLVED] Is there an INPUT TYPE = CREATE FILE?

Reply
  #1 (permalink)  
Old 09-08-08, 12:52 PM
jej1216 jej1216 is offline
Newbie Coder
 
Join Date: May 2007
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
[SOLVED] Is there an INPUT TYPE = CREATE FILE?

I have a Form that has the Submit button to insert data into a DB. I also need to create a small txt file when the user Submits the data.

Can this be part of Submit or is there a INPUT TYPE = CREATE FILE?
Reply With Quote
  #2 (permalink)  
Old 09-08-08, 12:55 PM
leeprice2006 leeprice2006 is offline
Newbie Coder
 
Join Date: Sep 2006
Posts: 68
Thanks: 0
Thanked 0 Times in 0 Posts
PHP Code:

$file "file.txt";
$handle fopen($file'w');
fclose($file); 
this will create a file in the same directory as the code that will process the form input
Reply With Quote
  #3 (permalink)  
Old 09-08-08, 04:04 PM
jej1216 jej1216 is offline
Newbie Coder
 
Join Date: May 2007
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Thanks! That worked.
Reply With Quote
  #4 (permalink)  
Old 09-08-08, 04:20 PM
jej1216 jej1216 is offline
Newbie Coder
 
Join Date: May 2007
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Followup question - I am using the following code to name the file:
PHP Code:

$sevvar substr("$_REQUEST[severity]"5, -21);


if (
$sevvar>"2") {
  
$file "notify/$sevvar".".$_REQUEST[fac_id]".".txt";
  
$handle fopen($file'w');
  
fclose($file);
  }
else
{
  echo 
"";
  } 
I want $file to look like this:
3.0012.txt
but I'm getting this:
3 .0012.txt ------------- with a 'space' between the 3 and the rest.

What change do I need in my $file codeline?

Thanks,
jej1216
Reply With Quote
  #5 (permalink)  
Old 09-08-08, 04:37 PM
jej1216 jej1216 is offline
Newbie Coder
 
Join Date: May 2007
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Got it

I got it - it was a data issue. I was picking up a space as well as the number in the value. I was at -21, needed to be at -22.

PHP Code:

$sevvar substr("$_REQUEST[severity]"5, -22);


if (
$sevvar>"2") {
  
$file "notify/$sevvar".".$_REQUEST[fac_id]".".txt";

  
$handle fopen($file'w');
  
fclose($file);
  }
else
{
  echo 
"";
  } 
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with my largest perl script. Grabbing data from a file. Sunnmann Perl 2 04-23-08 03:27 AM
Upload a file to a fix web folder of a website without using FTP software sujata_ghosh Perl 4 05-10-06 09:10 AM
setting a file mask for a file uploading input tag davidklonski JavaScript 0 07-07-04 06:22 AM
Select one type of file only from directory Bonzo PHP 6 04-27-04 04:58 AM
File input daveyisu Windows .NET Programming 1 03-25-04 04:08 PM


All times are GMT -5. The time now is 07:55 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.