0

I really don't know why this is not working. data1 and data2 will be sent to my php form but data3 will not no matter what i set it to be. Can anyone point out what is wrong that I may be simply overlooking.

    function flap(span) {
    var id1 = span.getAttribute('data-id1');
    var id2 = span.getAttribute('data-id2');
        var lop = id2.slice(8, 1000);
        var lip = id2.slice(0, 8);
        var str = lop;
        var n = str.lastIndexOf("/");
        var res = str.slice(0, n);
        var mac = res;
        var red = mac.lastIndexOf("/");
        var rem = red+1;
        var ret = mac.slice(rem, 1000);
        var slap = ret;
     $.ajax({
        url:'controlmysite/userfiles.php',
        type:'POST',
        data:{
            data1: id1, data3: slap, data2: lip + res,
        },
          success: function(filesDirectory1){
           $('#filesDirectory').html(filesDirectory1);
    }});}

I changed data3 to many different things; i even set it to id1, lip, res, and ret. I swapped positions with data1 and data2, but for some reason data3 simply will not send. Please someone point out what I am obviously overlooking. Thanks for any help.

Sheepherder
  • 47
  • 1
  • 2
  • 10

2 Answers2

0

the issue may be comming from the size of 'data3' that is too big
try giving a big value for "max_input_vars" and "post_max_size" in your 'php.ini' file or by defining it in the bigenning of the php script "controlmysite/userfiles.php"

ini_set('max_input_vars',100000);
ini_set('post_max_size','20M');

you can check this post increasing-the-maximum-post-size

zakaria35
  • 857
  • 1
  • 7
  • 12
0

(SOLVED) This is accepted answer. I don't have enough rep to check answered :)

Thank you all for your input. The problem was created by a separate ajax function call. i had to add to my php file the following.

       if(isset($_POST['data1']) && isset($_POST['data2']) && isset($_POST['data7'])) {
    $updir = $_POST['data2']; echo $updir."<br>";
    $id1 = $_POST['data1'];
    $id7 = $_POST['data7'];
    $id8 = $_POST['data8'];
       if(isset($_POST['data3'])) {$id3 = $_POST['data3'];}
    echo "<span id='".$updir."' title='".$id1." directory' class='point mud' value='".$updir."' onclick='flap(this)' data-id2='".$updir."'>
    <i class='fa fa-folder-open-o' style='color:blue'></i>&nbsp";
       if(isset($_POST['data3'])) { echo $id3;} else { echo $id7;}; echo "</span><br><br>";
    The rest of php...}

My controlmysite/userfiles.php was receiving 2 seperate ajax function posts and $id7 was overriding $id3. Two extra if(isset())'s solved the conflict.

I know this problem was PHP over-site error on my part, but will leave question and answer here for a reference in case anybody else has a "brain fart" like I did while coding. Thank you all for your time and have a great day.

Sheepherder
  • 47
  • 1
  • 2
  • 10