forms not working

Problems with the Windows version of XAMPP, questions, comments, and anything related.

forms not working

Postby cvdbAdmin » 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

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!!!
cvdbAdmin
 
Posts: 17
Joined: 19. January 2007 22:19

Postby Wiedmann » 06. February 2007 03:26

insert2.html

I miss a correct HTML structure.
("<html><head></head><body></body></html>")

insert2.php

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

BTW:
This script should work, but you should use $_POST instead of $HTTP_POST_VARS.
Wiedmann
AF Moderator
 
Posts: 17106
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Postby cvdbAdmin » 06. February 2007 21:10

I miss a correct HTML structure.
("<html><head></head><body></body></html>")


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:

Image

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.
cvdbAdmin
 
Posts: 17
Joined: 19. January 2007 22:19

Postby Wiedmann » 06. February 2007 21:24

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?
Wiedmann
AF Moderator
 
Posts: 17106
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Postby cvdbAdmin » 07. February 2007 23:23

Hey, thanks for your help but I did a reinstall of the xampp system and that seems to have fixed the problem.
cvdbAdmin
 
Posts: 17
Joined: 19. January 2007 22:19


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 66 guests