This article will illustrate a number of features to be included in this application which are useful in actual project implementations, such as:
Basic Code Implementation Before discussing the application features in detail, let's start with the most basic implementation, which does not contain the four additional functions listed above. The basic job is limited to: 1. Show web form to the user. 2. Get posted values from the web form and validate user inputs as to whether or not they're empty. 3. Write text to file (.txt). Showing the web form if it has not already been submitted <?php
//Check if the web form is NOT submitted if (!$_POST['submit'])
{
//Form is not submitted, display web form to the browser ?>
<h2>Enter any text below to write to a text file(limited to 200 words)</h2>
<form action="<?php echo $SERVER['PHP_SELF']; ?>"
method="post">
<br />
<textarea name="textinputs" rows="25" cols="60"></textarea>
<br />
<input type="submit" name="submit" value="Write this text to a text file">
</form>
<a href="/phpformtotextfilebasic">Click here to reset or clear this form</a>
<br />
<br /> This is what the web form will look on the browser: ![]()
blog comments powered by Disqus |
|
|
|
|
|
|
|