forms not working
Posted: 05. February 2007 23:55
Okay, I have a strange on for ya. I am working on an insert script for a database. This script needs to be able to take in a video, a thumbnail image, and some data about the video. I am doing this by setting up an HTML form that feeds into a PhP script. Of course because I am downloading a video and image, I am using a post. I had this working to some extent but now it doesn't work at all. I must have done something to upset the PhP gods because I have no idea what changed so that it stopped working. The problem that I seem to be having is that none of the arrays are being populated with information from the form. The two arrays that I am using are $HTTP_POST_VARS and $_FILES. When I submit the forms the fields that should be populated are not getting populated. It is as if I had just clicked on submit without putting anything in the fields of the form. I don't think that it is a code problem but I am going to include some of the code here just in case.
insert2.html
insert2.php
I only put in the very beginning of the code for insert2.php because that is where the problem is happening. This doesn't print out anything from the variables. I am also having issues with the $_FILES array not getting anything. If anybody has any ideas I would really appreciate it.
Thank you!!!
insert2.html
- Code: Select all
<form action="insert2.php" method="post" enctype="multipart/form-data" name="insert">
<input type="hidden" name="MAX_FILE_SIZE" value="3000000" />
<b>Title:</b><br />
<input name="title" type="text" size="50" /><br />
<b>Author:</b><br />
<input name="author" type="text" size="50" /><br />
<b>Date of Creation:</b><br />
<input name="date" type="text" size="20" /><br />
<b>Summary:</b><br />
<textarea name="summary" cols="50" rows="10" /></textarea><br />
<b>Department:</b><br />
<input name="dept" type="text" size="20" /><br />
<b>Media Type:</b><br />
<select name="mediatype">
<option value="video">Video</option>
<option value="image">Image</option>
<option value="audio">Sound clip</option>
</select><br />
<b>Video:</b><br />
<input name="video" id="video" type="file" /><br />
<b>Thumbnail:</b><br />
<input name="thumb" id="thumb" type="file" /><br />
<input name="submit" type="submit" value="Submit" />
<input name="reset" type="reset" value="Reset" />
</form>
insert2.php
- Code: Select all
$title = $HTTP_POST_VARS['title'];
$author = trim($HTTP_POST_VARS['author']);
$date = trim($HTTP_POST_VARS['date']);
$summary = trim($HTTP_POST_VARS['summary']);
$dept = trim ($HTTP_POST_VARS['dept']);
$mediatype = trim($HTTP_POST_VARS['mediatype']);
$TRUE = 1;
$FALSE = 0;
echo "Title: $title <br>";
echo "Author: $author <br>";
echo "Date: $date <br>";
echo "Summary: $summary <br>";
echo "Department: $dept <br>";
echo "Media type: $mediatype <br>";
I only put in the very beginning of the code for insert2.php because that is where the problem is happening. This doesn't print out anything from the variables. I am also having issues with the $_FILES array not getting anything. If anybody has any ideas I would really appreciate it.
Thank you!!!