I have tried to pass the values from javascript to PHP
Javascript
<script type="text/javascript">
const formData = JSON.parse(localStorage.getItem('formdata'));
const getthelocation = formData.getthelocation;`
</script>
PhP
<?php
$getLoc= ["<script>document.writeln(getthelocation );</script>"];
var_export ($getLoc);
Output
ARRAY ( 0 => 'ISTANBUL,TOKAT,BURSA,YALOVA ', )
But I'm Looking for
ARRAY ( 0 => 'ISTANBUL', 1 =>'TOKAT', 2 =>'BURSA', 3 =>'YALOVA')
Send your data from local storage in JS script, after this you can make with your data all you need: explode it by comma, make some value object, etc.
This will be the correct way.