Trying to get variables in hacked category dropdown

The dot . in your code is evaluated as string litral, and not concatenation. Meaning if $inpCnt was equal to 5 for example, php will search for name="scrape[".5.'][sponsors]' id= and will fail to find it. You can either remove the dots while still using the double quotes:

$sponsors = str_replace(
    "name="scrape["$inpCnt'][sponsors]' id=",
    "name="scrape["$inpCnt'][sponsors][]' multiple="multiple" size="19" id=",
    $sponsors
);

.. Or use concatenation:

$sponsors = str_replace(
    'name=\'scrape["'.$inpCnt.'"][sponsors]\' id=',
    'name=\'scrape["'.$inpCnt.'"][sponsors][]\' multiple=\'multiple\' size=\'19\' id=',
    $sponsors
);