Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8307575
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T18:33:16+00:00 2026-06-08T18:33:16+00:00

I have an issue with the checkboxes to get it working. If none of

  • 0

I have an issue with the checkboxes to get it working.
If none of the checkboxes have been selected, it gives an errormessage, this works fine!
Also the submitting of all other information.

I just want the form now to submit the checkboxes which have been checked into the confirmationemail. I now only get: array.

The contact.php

<?php
/* Set e-mail recipient */
$myemail  = "mukies@gmail.com";

/* Check all form inputs using check_input function */
$yourname = check_input($_POST['yourname'], "Vul uw naam in aub");

$email    = check_input($_POST['email']);
$telephone    = check_input($_POST['telephone']);
$comments = check_input($_POST['comments'], "Write your comments");

$formCampagne = check_input($_POST['formCampagne']);
foreach($formCampagne as $option) {
  print $option."\n";
}

/* If e-mail is not valid show error message */
if (!preg_match("/([\w\-]+\@[\w\-]+\.[\w\-]+)/", $email))
{
show_error("Dit e-mail adres is niet juist, voer een juist e-mailadres in.");
}
/* If telephone is not valid show error message */
if (!preg_match("/[0-9\(\)+.\- ]/s", $telephone))
{
show_error("Voer een juist telefoon nummer in");
}
/* If verification code is not valid show error message */

if (strtolower($_POST['code']) != 'mycode') {die('Voer aub de juiste code in, in     hoofdletters.');}

/* If no campaign mode is selected, show error message */
if(empty($formCampagne))
{
   show_error ("U heeft geen selectie gemaakt uit de campagne opties, selecteer minimaal een van de opties.");
}

/* Let's prepare the message for the e-mail */
$message = "Hi Rick,

Je hebt weer een offerte aanvraag ontvangen voor Limburg Media! :)

Name: $yourname
E-mail: $email
Telefoon: $telephone

Offerte aanvraag?    $formCampagne

Comments: $comments

End of message
";

/* Send the message using mail() function */
mail($myemail, $subject, $message);

/* Redirect visitor to the thank you page */
header('Location: thanks.htm');
exit();

/* Functions we used */
function check_input($data, $problem='')
{
$data = trim($data);
$data = stripslashes($data);
$data = htmlspecialchars($data);
if ($problem && strlen($data) == 0)
{
    show_error($problem);
}
return $data;
}

function show_error($myError)
{
?>
<html>
<body>

<b>Gelieve de onderstaande foutmelding door te nemen om uw gegevens correct aan te leveren:</b><br />
<?php echo $myError; ?>

</body>
</html>
<?php exit();}
?> }

The Contact.htm where the visitor fills in his/her form:

<html>
<body>

<p>Benodigde velden zijn <b>vetgedrukt</b>.</p>

<form action="contact.php" method="post">
<p><b>Uw naam:</b> <input type="text" name="yourname" /><br />
<b>E-mail:</b> <input type="text" name="email" /></p>
<b>Telefoonnummer:</b> <input type="text" name="telephone" /></p>

<p>Welk soort campagne wilt u informatie over ?<br />
<input type="checkbox" name="formCampagne[]" value="sandwichborden driehoeksborden"   />sandwichborden / driehoeksborden<br />
<input type="checkbox" name="formCampagne[]" value="drukwerk banners"   />drukwerk / banners<br />
<input type="checkbox" name="formCampagne[]" value="evenementen outdoor"   />outdoor promotie / evenemente<br />
<input type="checkbox" name="formCampagne[]" value="internet website social media"  />internet / websites / social media  <br />
<input type="checkbox" name="formCampagne[]" value="artwork video"   />artwork / videopromotie    <br />
<input type="checkbox" name="formCampagne[]" value="promo gadgets sampling" />promoteams / gadgets / sampling    <br />
<input type="checkbox" name="formCampagne[]" value="mobiele reclame reclame frames"   /> mobiele reclame / reclame frames    <br />  </p>


<p><b>Your comments:</b><br />
<textarea name="comments" rows="10" cols="40"></textarea></p>
<p>Validatie code: <input type="text" name="code" /><br />
Vul de tekst <b>MYCODE</b> hierboven in.   </p>
<p><input type="submit" value="Send it!"></p>


</form>

</body>
</html>

The thanks.htm page only contains standard text, saying, well… thank you. 🙂

Can anyone help me out here?

EDIT:

So this would be the correct code ?:

if(isset($formCampagne)) {
echo ".implode(',', $formCampagne)."; // this is the output in the confirmation mail
} else {
echo "U heeft geen selectie gemaakt uit de campagne opties, selecteer minimaal een van de opties.";

But where do I put it? Next to the “Offerte aanvraag?”, beacuse this gives an error, as I am in the $message field already.
Sorry I have not yet worked with a isset function yet.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T18:33:17+00:00Added an answer on June 8, 2026 at 6:33 pm

    Try replacing

    $message = "Hi Rick,
    
    Je hebt weer een offerte aanvraag ontvangen voor Limburg Media! :)
    
    Name: $yourname
    E-mail: $email
    Telefoon: $telephone
    
    Offerte aanvraag?    $formCampagne
    
    Comments: $comments
    
    End of message
    ";
    

    with:

    $message = "Hi Rick,
    
    Je hebt weer een offerte aanvraag ontvangen voor Limburg Media! :)
    
    Name: $yourname
    E-mail: $email
    Telefoon: $telephone
    
    Offerte aanvraag?    ".implode(',', $formCampagne)."
    
    Comments: $comments
    
    End of message
    ";
    

    Notice that I’ve changed the plain $formCampagne with implode(',', $formCampagne), ’cause it is actually an array and you have to make it a string if you want to place it in your e-mail message.

    Also notice that if none of the checkboxes are selected, $formCampagne will be NULL, so you should also check if isset($formCampagne)

    EDIT:

    in my example, $formCampagne should actually be $_POST['formCampagne'], I must admit I never used the check_input() function and do not really know how it behaves on arrays.

    You could also try to var_dump() the content of both $formCampagne and $_POST['formCampagne']

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have issue with: <form:checkboxes path=roles cssClass=checkbox items=${roleSelections} /> If previous line is used
I've been searching for a solution to this issue for a few days now.
I have a php array containing the mysql values of checkboxes, which has been
I've been struggling with this issue for a while now. Maybe you can help.
So I have this checkbox inside a gridview, and it is working properly for
I'm running into an issue where webrat can't see checkboxes. I have some code
I have checkboxes in spilt view of jQuery mobile and I can not get
This morning I am fighting with an issue. I need to have users fill
I am working in ColdFusion. Here is the issue I am having. I have
I have simple issue setting a two-way databinding of a checkbox in Silverlight 3.0.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.