Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

php form to txt file

Featured Replies

I'm trying find out how i would go about creating a form which when filled in and submitted will save the information on a .txt file on the server

 

i was hoping that each time information is submitted it will overwrite the previous data. its so a client can update his website without having to understand how to upload files to his server. there is a php 'includes' in the relevant page which takes the data from the text file so the client can change his opening times and special offers easily

 

i tried googling it but most tutorials are for sending data from a form via email, if anybody could point me in the right direction it would really help me out

 

thanks

Seth

I'm trying find out how i would go about creating a form which when filled in and submitted will save the information on a .txt file on the server

 

i was hoping that each time information is submitted it will overwrite the previous data. its so a client can update his website without having to understand how to upload files to his server. there is a php 'includes' in the relevant page which takes the data from the text file so the client can change his opening times and special offers easily

 

i tried googling it but most tutorials are for sending data from a form via email, if anybody could point me in the right direction it would really help me out

 

thanks

Seth

 

Hi Seth, something like this should do it (if you add validation etc):

 

<?php

$string = $_POST['string'];
$file = fopen("text.txt","w") or exit("Unable to open file!");
fwrite ($file, $string);
fclose($file);

?>

<form action="#" method='post'>
<input type='text' name='string' />
<input type='submit' />
</form>

 

I got it from here:

 

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

 

Hope that helps :)

 

Kirsty

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.