...

View Full Version : $_POST sumbit problems



jeramie78
08-08-2007, 05:09 AM
Hello ive been working on this addon for my site to upload files but im having problems with the post submit part of it here is my code. The problem is if the user visits the page or you refresh it sumbits blank data to the DB.


require("classes/video.class.php");

$video = new Video(320, 260, "#000"); //width, height, bacground color
$vid = '';
$video->uploaddir = "/home/gamer/public_html/files/flv/";
$video->localdir = "files/flv/";


// thumbnail name must be set for upload function to create movie thumbnail
$thumb = '';
$video->thumbnail_name = "$thumb";
$video->thumbnail_width = 150;
$video->thumbnail_height = 150;
$video->thumbnail_dir = "/home/gamer/public_html/files/thumbs/";
$video->thumbnail_localdir = "files/thumbs/";


$date = date("$time_an"); // Static date
$month = date("F Y"); // Archive month

mysql_query("INSERT INTO ccms_video SET url='$vid', title='$_POST[title]', cat_id='$_POST[cat_id]', date='$date', type='FLV', author='$_POST[creator]', allow_rating='$_POST[ratings]', allow_comments='$_POST[comments]', game='$_POST[game]', platform='$_POST[platform]', timestamp='$timestamp', description='$_POST[description]'");

if(isset($_FILES) && is_array($_FILES) && !empty($_FILES))
{
if(!$vid = $video->upload())
die("failed to upload video");
}

if (!isset($_POST['submit'])) {

echo "FORM DATA GOES HERE! "\n";
}


Any help is much appreciated.

Mwnciau
08-08-2007, 05:20 AM
Just check if the data is there:



if(empty($_POST['title'])) die ('Post data missing');

jeramie78
08-08-2007, 05:25 AM
well now when visiting the page i get post data missing. The problem is when you visit the page it auto submits all on its own i only want it to submit when you click the submit button.

jeramie78
08-08-2007, 05:53 AM
Found the solution to the problem
I had the php data in the wrong place it should of went like this.
Takes forever for the page to refresh though i think its still trying to convert on refresh just not submit.


echo "FORM DATA HERE!"\n;

if ($_POST['SUBMIT']) {
require("classes/video.class.php");

$video = new Video(320, 260, "#000"); //width, height, bacground color
$vid = '';
$video->uploaddir = "/home/gamer/public_html/files/flv/";
$video->localdir = "files/flv/";


// thumbnail name must be set for upload function to create movie thumbnail
$thumb = '';
$video->thumbnail_name = "$thumb";
$video->thumbnail_width = 150;
$video->thumbnail_height = 150;
$video->thumbnail_dir = "/home/gamer/public_html/files/thumbs/";
$video->thumbnail_localdir = "files/thumbs/";
if(isset($_FILES) && is_array($_FILES) && !empty($_FILES))
{
if(!$vid = $video->upload())
die("failed to upload video");
}
mysql_query("INSERT INTO ccms_video SET url='$vid', title='$_POST[title]', cat_id='$_POST[cat_id]', date='$date', type='FLV', author='$_POST[creator]', allow_rating='$_POST[ratings]', allow_comments='$_POST[comments]', game='$_POST[game]', platform='$_POST[platform]', timestamp='$timestamp', description='$_POST[description]'");


$date = date("$time_an"); // Static date
$month = date("F Y"); // Archive month
}



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum