Results 1 to 8 of 8

Thread: Web Site Input

  1. #1
    Junior Member
    Join Date
    Mar 2004

    Web Site Input

    I would like to set up some kind of a service with which a webserver can accept data and can save it to a local file(s). The data is going to be comments, tests, and other things.

    Very simply, I need to have a form on a web site that when submitted, will export the data either into a database, text file, what ever is easiest to do.

    I was looking at a few ways to do this, and they all discussed setting up a lot of new services, such as php, SQL, ASP, and other things. I was hoping that there would be some way to do this with something more simple that is already in Apache. Web server is Apache 2.0 on Win2k3 Ent. And no, I cannot change either of these things, it's for school and it is what the instructor wants.

    I understand that some kind of server side processing is needed, but I would like to try to get this accomplished as easily as possible.

    I have full admin rights and access to server box, but I don't want to have to work on it for hours to get this input thing up and running.

    If you chose to respond, please be descriptive, I have never set up anything like this before besides just a default phpBB + MySQL install in which I followed a page of instructions.

  2. #2
    You will need at least php...I'm pretty sure. You can make a form in HTML that links to a php script which can then write the data from the form into something like a text file.

    Very simply, I need to have a form on a web site that when submitted, will export the data either into a database, text file, what ever is easiest to do.
    Install php in your webserver, follow the apache instructions in the PHP docs, and write a script that will let you write to the textfile. Don't forget to change the text file permissions so its possible.

    BTW there is a web dev forum on this site as well.

    that link uses a plugin for winamp that will work with PHP to update a .txt file with your currently playing song. You can strip it down so it simply writes to a file, without the plugin crap.

  3. #3
    Junior Member
    Join Date
    Mar 2004
    If I used php, how much code would I have to use to be able to define a variable, send input to it, and save it to a text file? Or, without me having to learn php for this one thing, could someone else tell me what code I would have to include into the html page to do what I want? After I installed and enabled php in apache.

  4. #4
    Senior Member
    Join Date
    Jan 2002
    It's simple. You will have some html with form - for example something like this:
    <form method="post" action="./save.php" />
    <input type="text" name="inputtext" />
    <input type="submit" value="submit" />
    and save php could be something like this:
    PHP Code:
    more can be found at and w3schools.

    Good luck and feel free to have more questions.


  5. #5
    Senior Member
    Join Date
    Aug 2001
    (Phew, sun7dots didn't steal all my thunder, so I'm still going to hit post)

    Its easy in PHP, as that is exactly the kind of thing it was meant to do.

    Take a look at:

    from Codewalkers (if you couldn't tell by the url...)

    That article got me started with PHP. Before reading that article I hadn't written any code since the C class I took 2 or 3 years ago..., but I've found that even that little bit of knowledge has seriously sped up my learning curve. PHP is nice because it is relatively forgiving for small projects, but like all things the greater the scale the more you have to be careful.

    I don't know about Windows, but on both my *nix box and my MacOS X laptop installing/configuring php was REALLY easy.

    And, when all else fails, google! I know there is tons of stuff about Apache/PHP on Windows out there, because everytime I try to find something I have to skip over all that crap. There is tons of info out there, as I can think of atleast 5 sites that I frequent for tutorials and articles about PHP off the top of my head, and my memory is terrible.

    PHP (less a place for tutorials and more a place for the manual
    Zend Tutorials

    I image that Jupiter Media maintains somekind of php tutorial site somewhere, what it is, I wouldn't be able to tell you right now.

    Anyway, short of writing the code for you, I've given you what I can think of at this particular moment.

    (One of these days I'll make a lucid post...)

    Oh, the hardest thing of working with mySQL in php is the actual SQL queries themselves. Having never used a database before writing a database driven website, I pulled some of my hair out. Once you get the hang of it though, you start finding really handy functions.

    Go nuts,
    The owl of Minerva spreads its wings only with the falling of dusk. -Hegel

  6. #6
    Senior Member
    Join Date
    Jan 2003
    Hey Hey,

    I'll post the same as everyone else has, but I'll post the complete thing from start to finish. I wrote this out when I wanted to create a simple guestbook that didn't require a back-end database, just a nice and simple flatfile. This was the resultant code.

    This form allowed for user input.
    <table width="100%">
    <form method="post" action="core.php?Link=write_msg">
    At This time ,'s cannot be used. Hopefully this bug will be fixed soon.
    Name:</td><td><input type="text" name="name"><br></td></tr><tr><td>
    E-Mail:</td><td><input type="text" name="email"><br></td></tr><tr><td>
    Website:</td><td><input type="text" name="website"><br></td></tr><tr><td>
    Comment:</td><td><input type="textarea" name="comment"><br></td>

    This code would take the form values and write them to a text file.
    $post =  "$name , $email, $website, $comment";
    $filename = "\webshare\wwwroot\posts.txt";
    $fp = fopen($filename, "r");
    $post2 = fread($fp, filesize ($filename));
    $post3 = $post2 . "\n" . $post;
    $filename = "\webshare\wwwroot\posts.txt";
    $fp = fopen($filename, "w");
    fputs($fp, $post3);
    This could would display the textfile back to the user.
    <OBJECT id=msg CLASSID="clsid:333C7BC4-460F-11D0-BC04-0080C7055A83">
         <PARAM NAME="DataURL" VALUE="posts.txt">
         <PARAM NAME="UseHeader" VALUE="True">
    <TABLE ID=posts datasrc=#msg>
           <TD>Name:<SPAN DATAFLD="Name"></SPAN></TD>
         	<TD>E-Mail:<SPAN DATAFLD="Email"></SPAN></TD>
         	<TD>Website:<SPAN DATAFLD="WebSite"></SPAN></TD>
           <TD>Comment:<SPAN DATAFLD="Comment"></SPAN> <br><hr><br></TD>
    Now this code obviously isn't the cleanest, I wrote this back when I was still new to html and have never modified it, but it does work quite nicely.


  7. #7
    Junior Member
    Join Date
    Mar 2004
    Thank you everyone, exactly what I was looking for.

  8. #8
    Webius Designerous Indiginous
    Join Date
    Mar 2002
    South Florida
    *xmaddness contimplates posting an entire PHP/MySQL solution to this question.

    Its good to see people other than the same 3 or 4 answering questions in this forum.

    Let us know how it goes Nick!


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts