Current location: Hot Scripts Forums » Programming Languages » PHP » Form -> text file -> php variables


Form -> text file -> php variables

Reply
  #1 (permalink)  
Old 06-10-04, 04:28 PM
Bonzo's Avatar
Bonzo Bonzo is offline
Coding Addict
 
Join Date: Jan 2004
Posts: 340
Thanks: 0
Thanked 0 Times in 0 Posts
Form -> text file -> php variables

I think I am totaly lost again !!

I have a form that I want to use to create a php settings type page, I am doing it this way as people may not be happy altering php code !

PHP Code:

// Form

<form enctype="multipart/form-data" ACTION="write.php" method=POST>
  Upload directory : <input name="normal" size="60" type="text" value=" <?php echo $server.$base_url?>/up"><br>
<input name="submit" size="20" type="Submit">
<input name="reset" size="20" type="Reset">
</form>

// Write to text file
$filename = 'data.txt'; // Save information to this file
if (file_exists("$filename")):   // IF data.txt File exists
  $cartFile = fopen("$filename","a[b]");   // Open data.txt File
  fputs($cartFile,$normal);   // Write data (put) to File
  fclose($cartFile);   // Close data.txt File
else:
  $cartFile = fopen("$filename","a[b]");   // IF data.txt doesn't exists - create it!
  fputs($cartFile,$normal);
  fclose($cartFile);
endif;
This all basicly works OK.

The problem then is that I cant pass e.g. $normal=public_html........ as the "$" gives a problem.

So I thought pass the "public_html........ " in the text file and then link it to the $normal in the php code but I have a problem with the "$" here as well which means joining then adding the after "$" which is all a bit long winded.

Can anyone help ?

Anthony
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 06-16-04, 08:37 AM
Worm's Avatar
Worm Worm is offline
Newbie Coder
 
Join Date: Jun 2004
Location: Germany, Frankfurt am Main
Posts: 91
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by Bonzo
I think I am totaly lost again !!

I have a form that I want to use to create a php settings type page, I am doing it this way as people may not be happy altering php code !

PHP Code:

// Form

<form enctype="multipart/form-data" ACTION="write.php" method=POST>
  Upload directory : <input name="normal" size="60" type="text" value=" <?php echo $server.$base_url?>/up"><br>
<input name="submit" size="20" type="Submit">
<input name="reset" size="20" type="Reset">
</form>

// Write to text file
$filename = 'data.txt'; // Save information to this file
if (file_exists("$filename")):   // IF data.txt File exists
  $cartFile = fopen("$filename","a[b]");   // Open data.txt File
  fputs($cartFile,$normal);   // Write data (put) to File
  fclose($cartFile);   // Close data.txt File
else:
  $cartFile = fopen("$filename","a[b]");   // IF data.txt doesn't exists - create it!
  fputs($cartFile,$normal);
  fclose($cartFile);
endif;
This all basicly works OK.

The problem then is that I cant pass e.g. $normal=public_html........ as the "$" gives a problem.

So I thought pass the "public_html........ " in the text file and then link it to the $normal in the php code but I have a problem with the "$" here as well which means joining then adding the after "$" which is all a bit long winded.

Can anyone help ?

Anthony
I read your code and I read your problem but i couldnt understand it. Could you explain what you mean with: "... i get a problem with the "$" ... " ?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
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
PHP code to edit a text file mdhall Script Requests 12 12-23-10 05:03 AM
PHP write to text file veeco Script Requests 2 02-10-10 03:48 PM
How to write a php script to load a text file into a table automatically? xmxpcom PHP 2 02-12-04 09:37 AM
Upload file to table so ONLY files tied to primary key are displayed in record? grafixDummy PHP 4 12-20-03 05:28 PM
picking random entries with a filter... Double selection problem dsumpter PHP 7 11-16-03 08:19 PM


All times are GMT -5. The time now is 05:51 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.