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

  • Home
  • SEARCH
  • 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 6468345
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T05:52:52+00:00 2026-05-25T05:52:52+00:00

I’m trying to set up a simple PHP contact form for a website and

  • 0

I’m trying to set up a simple PHP contact form for a website and I need some help modifying the PHP to list multiple items from a select menu and would appreciate the help. I’m a graphic designer, not a developer, so a lot of this is way over my head. This is the problem area here:

HTML:

<form method="post" action="projectplanner.php">
<label>Name*</label><input class="text" name="name" placeholder="Typ hier uw naam">
<label>Email*</label><input class="text" name="email" type="email" placeholder="Typ hier uw email">
<label>Telefoon*</label><input class="text" name="telefoon" type="tel" placeholder="Telefoon of mobiel">
<label>Organisatie*</label><input class="text" name="organisatie" placeholder="Ik vertegenwoordig..">
<label>Bestaande website (indien van toepassing)</label><input class="text" name="website" placeholder="http://www">
<label>Soort project</label>
<input name="project[]" type="checkbox" value="huisstijl" class="check" />Huisstijl<br />
<input name="project[]" type="checkbox" value="websiteontwerp" class="check"/>Website ontwerp<br />
<input name="project[]" type="checkbox" value="websiteontwikkeling" class="check"/>Website ontwikkeling<br />
<input name="project[]" type="checkbox" value="onlinemarketing" class="check-last"/>Online marketing<br /> 
<label>Beschrijving van uw project</label>
<textarea class="project_text" name="beschrijving" placeholder="Een globale beschrijving. Doelstelling, publiek, concurenten?"></textarea>
<label>Inspiratie</label>
<textarea class="project_text" name="inspiratie" placeholder="Kopieer links naar website / apps / afbeeldingen die u inspireren"></textarea>
<label>* 2+2= ? (Anti-spam)</label>
<input name="human" placeholder="Antwoord">
<input id="submit" name="submit" type="submit" value="Verzend">

PHP:

<?php
$naam = $_POST['naam'];
$email = $_POST['email'];
$telefoon = $_POST['telefoon'];
$organisatie = $_POST['organisatie'];
$website = $_POST['website'];
$beschrijving = $_POST['beschrijving'];
$project = $_POST['project'];
$inspiratie = $_POST['inspiratie'];
$from = 'From: the website'; 
$to = 'someone@somewhere.com'; 
$subject = 'onderwerp';
$human = $_POST['human'];

$body = 
"Van: $name\n 
E-Mail: $email\n 
Telefoon: $telefoon\n 
Organisatie: $organisatie\n 
Website: $website\n 
Project Soort: $project\n 
Omschrijving: $beschrijving\n
Inspiratie: $inspiratie";
if ($_POST['submit'] && $human == '4') {                 
    if (mail ($to, $subject, $body, $from)) { 
    print ("Dank u wel");
    /*echo '<p>Uw bericht is verzonden!</p>';*/
} else { 
    echo '<p>Oeps. Er ging iets fout. Probeer nogmaals.</p>'; 
} 
} else if ($_POST['submit'] && $human != '4') {
/*echo '<p>Uw anti-spam antwoord is niet goed ingevuld.</p>';*/
}
  • 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-05-25T05:52:53+00:00Added an answer on May 25, 2026 at 5:52 am

    This will list the projects (if any have been checked) like so:

    Project Soort: websiteontwerp, websiteontwikkeling, onlinemarketing

    <?php
    // insure form variables exist
    $name         = isset($_POST['name'])         ? $_POST['name']         : '';
    $email        = isset($_POST['email'])        ? $_POST['email']        : '';
    $telefoon     = isset($_POST['telefoon'])     ? $_POST['telefoon']     : '';
    $organisatie  = isset($_POST['organisatie'])  ? $_POST['organisatie']  : '';
    $website      = isset($_POST['website'])      ? $_POST['website']      : '';
    $beschrijving = isset($_POST['beschrijving']) ? $_POST['beschrijving'] : '';
    $inspiratie   = isset($_POST['inspiratie'])   ? $_POST['inspiratie']   : '';
    $human        = isset($_POST['human'])        ? $_POST['human']        : '';
    $submit       = isset($_POST['submit'])       ? true                   : false;
    
    $project = isset($_POST['project'])
             ? implode(', ', $_POST['project'])     // gather selected checkboxes
             : 'Er geen projecten geselecteerd';    // (Unsure of translation)
    
    $from = 'From: the website'; 
    $to = 'someone@somewhere.com'; 
    $subject = 'onderwerp';
    
    $body = 
    "Van: $name\n 
    E-Mail: $email\n 
    Telefoon: $telefoon\n 
    Organisatie: $organisatie\n 
    Website: $website\n 
    Project Soort: $project\n 
    Omschrijving: $beschrijving\n
    Inspiratie: $inspiratie";
    
    if ($submit && $human == '4') {
        if (mail ($to, $subject, $body, $from)) {
            print ("Dank u wel");
            /*echo '<p>Uw bericht is verzonden!</p>';*/
        } else {
            echo '<p>Oeps. Er ging iets fout. Probeer nogmaals.</p>';
        }
    } else if ($submit && $human != '4') {
            /*echo '<p>Uw anti-spam antwoord is niet goed ingevuld.</p>';*/
    }
    ?>
    

    If any checkboxes are select when a user sends the form, PHP receives them as an array. The implode() function, pulls all of them together into a comma separated string. Feel free to change the comma (and/or the space following it) to something else if you like.

    Hope this helps.

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

Sidebar

Related Questions

I have just tried to save a simple *.rtf file with some websites and
I'm trying to create an if statement in PHP that prevents a single post
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text
I used javascript for loading a picture on my website depending on which small
this is what i have right now Drawing an RSS feed into the php,

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.