I have an array in javascript that separated with ,
. but inside of them there are some values containing ,
as it's value. my problem is I don't want to explode such these values but the php does it. Is there any way to handle it?
<form id="form" method="post">
<table>
<tr val="sprots, music, videos"><td>sprots, music, videos</td></tr>
......
......
<tr val="car"><td>car</td></tr>
</table>
<input type="hidden" name="category" id="category" value="">
</form>
<script>
var Data=[];
$('table').find('tr').each(function(){
Data.push($(this).attr('val'));
});
$('#category').val(Data);
</script>
<?php
$category=$_POST['category'];
$tmp=explode(',',$category);
?>
the problem occurs when it wants to explode value like this:array[0]='sports, music,videos'
. it explodes it as 3 separated array which is sth like this:
array[0]='sports', array[1]='music', array[2]='videos'.
I want to explode this value as a unique part, I mean like this:
array[0]='sports, music,videos'