1

So I've looked around at several older questions here on Stack Overflow and none of them seem to give me the right output so I figured I should just ask my own question.

This is likely a very basic answer, I am just not well versed in PHP. I am trying to send an array of checkboxes via e-mail to no success so far. Below is a small sample from what I have so far in the form:

HTML

<input type="checkbox" name="colorstones[White]" value="White" />White
<input type="checkbox" name="colorstones[Pink]" value="Pink" />Pink
<input type="checkbox" name="colorstones[Yellow]" value="Yellow" />Yellow
<input type="checkbox" name="colorstones[Light Brown/Cognac]" value="Light Brown/Cognac" />Light Brown/Cognac

PHP

$finish_colors = implode(', ', $_POST['colorstones']);
$body = $colorstones;

$subject = 'Scio Test Form Submission';
$headers = 'From: [email protected]' . "\r\n" .
'Reply-To: [email protected]';
$to = '[email protected]';

mail ($to, $subject, $body, $headers);

The e-mail sends fine, and all of the other text/radio fields that I have send fine, it just seems to be the checkboxes that give me an issue. The output of this when assigning $colorstones to $body, returns nothing in the message body.

Joey

1 Answer 1

3
$colorstones = implode(', ', $_POST['colorstones']);
$body = $colorstones;

$subject = 'Scio Test Form Submission';
$headers = 'From: [email protected]' . "\r\n" .
'Reply-To: [email protected]';
$to = '[email protected]';

mail ($to, $subject, $body, $headers);
Sign up to request clarification or add additional context in comments.

1 Comment

Oh wow..used the wrong variable (palm to face). Thanks for pointing out my silly mistake Qaisar, too early in the morning I suppose!

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.