I have to create an html/php program that can do the following As an editor coll
ID: 3625525 • Letter: I
Question
I have to create an html/php program that can do the followingAs an editor collects articles, articles are retrieved by a category. For example, an editor click "World" from the category selection menu, all the articles that are under the World category will be described.
1. Write a HTML/PHP program that can take user input about category selection and article body.
2. Each record of the category and the body appended to a file.
3. Write a HTML/PHP program that can display all the articles based on category that is selected.
This is my html code but i am unable to write the php code that will post and retrieve the article
<html>
<head>
<title>Article </title>
</head>
<body>
<P align=center><i><FONT face="Georgia, Arial" color=#8A2BE2 size=6>PROJECT 3</FONT></i></P>
<P align=center><i><FONT face="Georgia, Arial" color=#8A2BE2 size=8>Post Article</FONT></i></P>
<form enctype="multipart/form-data" action="postArticle.php" method="post">
<table border="0">
<tr bgcolor="#9400D3">
<td width="150">Category</td>
<td align="left"> <select name="articleField"> <option>Choose Field... </option>
<option value="World">World</option>
<option value="US">US</option>
<option value="Politics">Politics</option>
<option value="Business">Business</option>
<option value="Technology">Technology</option>
<option value="Arts">Arts</option>
<option value="Sports">Sports</option>
</select></td>
</tr>
<tr> <td> Title</td>
<td width="700"> <input type="text" name="title" ></td>
</tr>
<tr colspan="2">
<td>Add Article</td>
<td>
<textarea name="article" rows=20 cols="100" > </textarea> </td> </tr>
<tr> <td align="center" colspan=2>
<input type="Submit" name="Submit" value="Submit" /> </td>
<tr> <td align="center" colspan=2>
<input type="reset" name"reset" />
</tr>
</table>
</form>
</body>
</html>
Please help I am stumped how do I write the php code?
Explanation / Answer
<?php
if ($_FILES["file"]["error"] > 0)
{
echo "Error: " . $_FILES["file"]["error"] . "<br />";
}
else
{
echo "Upload: " . $_FILES["file"]["name"] . "<br />";
echo "Type: " . $_FILES["file"]["type"] . "<br />";
echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />";
echo "Stored in: " . $_FILES["file"]["tmp_name"];
}?>