No actually I found out why my statement wasn't working. Consider the following:
$var2=ereg_replace("-","",$var2);
$var2=ereg_replace(" ","-",$var1);
The first statement has no effect because the variable where the dashes are being removed from is being replaced with var1.
The correct code is:
$var2=ereg_replace("-","",$var1);
$var2=ereg_replace(" ","-",$var2);
I'm actually using ereg now instead of str_replace() to keep things consistent.