Win a copy of Rust Web Development this week in the Other Languages forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

document_root and fopen function with input form

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello!

I have two files in HTML and PHP (I'm not using mySQL at all right now) where I have a short input form on the first page and a second page that displays the results. I need to change them so that the input form writes to a separate text file and I have a lot of questions but right now my questions are limited to the DOCUMENT_ROOT and _SERVER statements and the fopen function statements.

This is what I have right now in the index.php to append to a text file:
$DOCUMENT_ROOT = $_SERVER['DOCUMENT_ROOT'];
$myFile=fopen("$DOCUMENT_ROOT/guestlist.txt","a+");

This is what I have in my display page to read from the text file. It will eventually display an HTML table of the results.:
$DOCUMENT_ROOT = $_SERVER['DOCUMENT_ROOT'];
$myFile=fopen("$DOCUMENT_ROOT/guestlist.txt","r");

Can anyone tell me if this is even close to correct? I guess I'm most confused about everything after the '=' sign on the first line.

Thank in advance for any answers!

J. Allen

 
reply
    Bookmark Topic Watch Topic
  • New Topic