0

i have a form that contains checkboxes. I've named the checkboxes as stream[], so it's an array of checkboxes.

I would like to insert the checkbox values if it is checked.

<p><input type="checkbox" name="stream[]" value="survey" id="svy"/>Survey</p>
                <p><input type="checkbox" name="stream[]" value="write_review" id="wr">Write Review</p>
                <p><input type="checkbox" name="stream[]" value="fb post" id="fbp">Facebook Post</p>.

How do i do that?

1 Answer 1

1

should not be that difficult, check out this link and this. But the essential idea is to know the right way to access the checkbox. Below is the general idea, a little homework for you to do the necessary changes to the code below to suit your situation.

$streams = $_POST['stream'];
foreach ($streams as $stream) {
  if ($stream == $value)
  {
     // checked value.
  }
}
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.