Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Aug 2007
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    $_POST sumbit problems

    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.

    PHP Code:
    require("classes/video.class.php");

    $video = new Video(320260"#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.

  • #2
    Regular Coder
    Join Date
    May 2006
    Location
    Wales
    Posts
    820
    Thanks
    1
    Thanked 82 Times in 79 Posts
    Just check if the data is there:

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

  • #3
    New to the CF scene
    Join Date
    Aug 2007
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

  • #4
    New to the CF scene
    Join Date
    Aug 2007
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.
    PHP Code:
    echo "FORM DATA HERE!"n;

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

    $video = new Video(320260"#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



  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •