-2

I'm trying to get the checked values into a PHP array so that I am able to loop through the array but I can't seem to convert it to an array.

jQuery Ajax Posts

checked=28,24

PHP

$checked = $_POST['checked'];

$arr = array($checked);
print_r($arr);

OUTPUT

Array
(
    [0] => 28,24
)

1 Answer 1

2

Use explode function to convert comma separated string to an array,

$arr = explode(",",$checked);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.