如何在foreach循环中绑定pdo值

I have this code written for PHP (PDO) -> SQL server. It throws no error, but won't return anything from the DB. I have tried running the SQL it outputs in SQL server management studio and it works perfect. Also, I am outputting the parameters to bind together to make sure it all looks good and it does. For some reason on execution the binds are preventing the SQL running properly. Is there something wrong with this method? Is it even possible to bind in array loops like i am trying here? Code is below, thanks in advance.

public function insertStaff( $table, $param )
{
    $qStr = '';
    foreach( $_POST as $k => $v )
    {
        if( $k == 'dummy' || $v == '' )
        {
            $qStr .= '';
        }
        else
        {
            $qStr .= '?,';
        }
    }
    $qStr = rtrim( $qStr, ',' );
    $sql = "INSERT INTO ? ($qStr) VALUES ($qStr)";
    $stmt = $this->c->prepare( $sql );
    //bind table
    $stmt->bindValue( 1, $table, PDO::PARAM_STR );
                        $output = '';
    $x = 2;
    foreach( $_POST as $k => $v )
    {
        if( $k !== 'dummy' && $v !== '' )
        {
            $stmt->bindValue( $x, $k, PDO::PARAM_STR );
            $output .= '<hr>'.$x.' => '.$k;
            $x++;
        }
    }
    foreach( $_POST as $k => $v )
    {
        if( $k !== 'dummy' && $v !== '' )
        {
            $stmt->bindValue( $x, $v, PDO::PARAM_STR );
            $output .= '<hr>'.$x.' => '.$v;
            $x++;
        }
    }
    //return $output;
    if( $stmt->execute() )
    {
        return 'success';
    }
    else
    {
        return 'fail';
    }
}