Page 1 of 1

forms not working

PostPosted: 05. February 2007 23:55
by cvdbAdmin
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.


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" />


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!!!

PostPosted: 06. February 2007 03:26
by Wiedmann

I miss a correct HTML structure.


I miss the script start and end.
("<?php" / "?>")

This script should work, but you should use $_POST instead of $HTTP_POST_VARS.

PostPosted: 06. February 2007 21:10
by cvdbAdmin
I miss a correct HTML structure.

I miss the script start and end.
("<?php" / "?>")

These were implied. I just only copied over the code that was involved in the problems that I was having. I did make the change that was suggested but it didn't make a difference. Like I said in the first post, I don't think that it is a problem with my code. I think that it has to do with the server itself. If anybody has any Ideas I would appreciate it. The output that I get with the code looks like this:


The url in this picture has been adjusted for security reasons so don't worry about that if it looks strange. Thank you for any help that you might be able to give.

PostPosted: 06. February 2007 21:24
by Wiedmann
These were implied.

I don't know what you really have. I only know what you post here ;-)

The output that I get with the code looks like this:

But one question:
You have select a video file for submission?

PostPosted: 07. February 2007 23:23
by cvdbAdmin
Hey, thanks for your help but I did a reinstall of the xampp system and that seems to have fixed the problem.