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 7059341
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T04:13:14+00:00 2026-05-28T04:13:14+00:00

I have a problem with the appointment form. When the form is filled in

  • 0

I have a problem with the appointment form. When the form is filled in by the customer, but a required field is left blank, this field will get an error message. This works fine. The problem is that the different choice menu’s on this page get a strange structure then. With this problem the wrong date will be sent. If you want you can test the form here; http://www.o-vita.nl/afspraak.php.

The Form:

          <form action="afspraak_verstuur.php" method="post" name="contact_form">
                <table width="300" border="0">
                        <tr>
                        <td class="tabform">Naam*:</td>
                        <td>&nbsp;</td>
                        </tr>
                        <tr>
                        <td colspan="2">
                                                                          <select name="aanhef" type="text" class="text_aanhef" value="Selecteer uw aanhef" />
                     <option value="Aanhef">Aanhef</option>
                    <option value="Mevr.">Mevr.</option>
                    <option value="Dhr.">Dhr.</option>

                    </select>
    <?php echo (isset($_SESSION['aanhef'])) ? $_SESSION['aanhef'] : ""; ?>
                                <input name="name" type="text" class="text_naam" value="<?php echo (isset($_SESSION['name'])) ? $_SESSION['name'] : ""; ?>" /></td>
                </tr>
                <?php if (in_array('name', $_GET['error'])) { ?>
                <tr>
                        <td colspan="2">
                                <font color="red">Er is geen naam ingevuld</font>
                        </td>
                </tr>
                <?php } ?>


                        <tr>
                        <td class="tabform">E-mail*:</td>
                                <td>&nbsp;</td>
                        </tr>
                        <tr>
                                <td colspan="2">
                                        <input name="email" type="text" class="text_veld" value="<?php echo (isset($_SESSION['email'])) ? $_SESSION['email'] : ""; ?>" />
                                </td>
                        </tr>
                        <?php if (in_array('email', $_GET['error'])) { ?>
                <tr>
                        <td colspan="2">
                                <font color="red">Er is geen e-mailadres ingevuld</font>
                        </td>
                </tr>
                <?php } ?>
                        <tr>


                        <tr>
                        <td class="tabform">Adres:</td>
                                <td>&nbsp;</td>
                        </tr>
                        <tr>
                                <td colspan="2">
                                        <input name="adres" type="text" class="text_veld" value="<?php echo (isset($_SESSION['adres'])) ? $_SESSION['adres'] : ""; ?>" />
                                </td>
                        </tr>
                        <?php if (in_array('adres', $_GET['error'])) { ?>
                <tr>
                        <td colspan="2">
                                <font color="red">Er is geen adres ingevuld</font>
                        </td>
                </tr>
                <?php } ?>
                        <tr>


                                <tr>
                        <td class="tabform">Postcode:</td>
                                <td>&nbsp;</td>
                        </tr>
                        <tr>
                                <td colspan="2">
                                        <input name="postcode" type="text" class="text_veld" value="<?php echo (isset($_SESSION['postcode'])) ? $_SESSION['postcode'] : ""; ?>" />
                                </td>
                        </tr>
                        <?php if (in_array('postcode', $_GET['error'])) { ?>
                <tr>
                        <td colspan="2">
                                <font color="red">Er is geen postcode ingevuld</font>
                        </td>
                </tr>
                <?php } ?>
                        <tr>


            <tr>
                        <td class="tabform">Woonplaats:</td>
                                <td>&nbsp;</td>
                        </tr>
                        <tr>
                                <td colspan="2">
                                        <input name="woonplaats" type="text" class="text_veld" value="<?php echo (isset($_SESSION['woonplaats'])) ? $_SESSION['woonplaats'] : ""; ?>" />
                                </td>
                        </tr>
                        <?php if (in_array('woonplaats', $_GET['error'])) { ?>
                <tr>
                        <td colspan="2">
                                <font color="red">Er is geen woonplaats ingevuld</font>
                        </td>
                </tr>
                <?php } ?>
                        <tr>


                        <tr>
                        <td class="tabform">Telefoon*:</td>
                                <td>&nbsp;</td>
                        </tr>
                        <tr>
                                <td colspan="2">
                                        <input name="telefoon" type="text" class="text_veld" value="<?php echo (isset($_SESSION['telefoon'])) ? $_SESSION['telefoon'] : ""; ?>" />
                                </td>
                        </tr>
                        <?php if (in_array('telefoon', $_GET['error'])) { ?>
                <tr>
                        <td colspan="2">
                                <font color="red">Er is geen telefoonnummer ingevuld</font>
                        </td>
                </tr>
                <?php } ?>
                        <tr>

            <tr>
                        <td class="tabform">Datum*:</td>
                                <td>&nbsp;</td>
                        </tr>
                        <tr>
                                <td colspan="2">
                                        <select name="dag" type="text" class="text_dag" value="Selecteer een dag" />
                    <option value="maandag">maandag</option>
                    <option value="dinsdag">dinsdag</option>
                    <option value="woensdag">woensdag</option>
                    <option value="donderdag">donderdag</option>
                    <option value="vrijdag">vrijdag</option>
                    <option value="zaterdag">zaterdag</option>
                    </select>
    <?php echo (isset($_SESSION['dag'])) ? $_SESSION['dag'] : ""; ?>

                    <select name="dag_nummer" type="text" class="text_dag_nummer" value="1" />
                    <option value="1">1</option>
                    <option value="2">2</option>
                    <option value="3">3</option>
                    <option value="4">4</option>
                    <option value="5">5</option>
                    <option value="6">6</option> 
                    <option value="7">7</option>
                    <option value="8">8</option>
                    <option value="9">9</option>
                    <option value="10">10</option>
                    <option value="11">11</option>
                    <option value="12">12</option>
                    <option value="13">13</option>
                    <option value="14">14</option>
                    <option value="15">15</option>
                    <option value="16">16</option>
                    <option value="17">17</option>
                    <option value="18">18</option> 
                    <option value="19">19</option>
                    <option value="20">20</option>
                    <option value="21">21</option>
                    <option value="22">22</option>
                    <option value="23">23</option>
                    <option value="24">24</option>
                    <option value="25">25</option>
                    <option value="26">26</option>
                    <option value="27">27</option>
                    <option value="28">28</option>
                    <option value="29">29</option>
                    <option value="30">30</option>
                    <option value="31">31</option>
                    </select>
    <?php echo (isset($_SESSION['dag_nummer'])) ? $_SESSION['dag_nummer'] : ""; ?>

                    <select name="maand" type="text" class="text_maand" value="Januari" />
                    <option value="januari">januari</option>
                    <option value="februari">februari</option>
                    <option value="maart">maart</option>
                    <option value="april">april</option>
                    <option value="mei">mei</option>
                    <option value="juni">juni</option>
                    <option value="juli">juli</option>
                    <option value="augustus">augustus</option>
                    <option value="september">september</option>
                    <option value="oktober">oktober</option>
                    <option value="november">november</option>
                    <option value="december">december</option>
                    </select>
      <?php echo (isset($_SESSION['maand'])) ? $_SESSION['maand'] : ""; ?>
                                </td>
                        </tr>
                        <?php if (in_array('datum', $_GET['error'])) { ?>
                <tr>
                        <td colspan="2">
                                <font color="red">Er is geen datum ingevuld</font>
                        </td>
                </tr>
                <?php } ?>
                        <tr>


            <tr>
                        <td class="tabform">Tijd*:</td>
                                <td>&nbsp;</td>
                        </tr>
                        <tr>
                                <td colspan="2">
                                        <input name="tijd" type="text" class="text_veld" value="<?php echo (isset($_SESSION['tijd'])) ? $_SESSION['tijd'] : ""; ?>" />
                                </td>
                        </tr>
                        <?php if (in_array('tijd', $_GET['error'])) { ?>
                <tr>
                        <td colspan="2">
                                <font color="red">Er is geen tijd ingevuld</font>
                        </td>
                </tr>
                <?php } ?>
                        <tr>


            <tr>
                        <td class="tabform">Opmerking:</td>
                                <td>&nbsp;</td>
                        </tr>
                        <tr>
                                <td height="60" colspan="2">
                                        <textarea name="opmerking" type="text" class="text_comments" rows="4" value="" /><?php echo (isset($_SESSION['opmerking'])) ? $_SESSION['opmerking'] : ""; ?></textarea>
                                </td>
                        </tr>
                        <?php if (in_array('opmerking', $_GET['error'])) { ?>
                <tr>
                        <td colspan="2">
                                <font color="red">Er is geen opmerking ingevuld</font>
                        </td>
                </tr>
                <?php } ?>
                                    <tr>
            <td class="tabform">
                Nieuwsbrief ontvangen?
                  <br /><input name="newsletter" type="radio" id="news_true" value="Ja" checked="checked" /> 
                <label for="news_true">Ja</label>
                <input type="radio" name="newsletter" id="news_false" value="Nee" />
                <label for="news_false">Nee</label>
            </td>
            <td>&nbsp;</td>
        </tr>
        <?php if (in_array('name', $_GET['error'])) { ?>
        <tr>
            <td colspan="2">
                Er is geen nieuwsbrief vermelding ingevuld
            </td>
        </tr>
        <?php } ?>


                        <tr>
                                <td colspan="2" class="verzenden">
                                        <input name="verzenden" type="image" id="verzenden" src="img/verzenden.png" alt="Verzenden" title="Verzenden" />
                                </td>
                        </tr>
                </table>
        </form>

Here is the script to send the mail:

 <?php
error_reporting(0);
session_start();


if ("post" === strtolower($_SERVER['REQUEST_METHOD'])) {

    $aanhef = $_POST['aanhef'];
    $name = $_POST['name'];
    $email = $_POST['email'];
    $adres = $_POST['adres'];
    $postcode = $_POST['postcode'];
    $woonplaats = $_POST['woonplaats'];
    $telefoon = $_POST['telefoon'];
    $dag = $_POST['dag'];
    $dag_nummer = $_POST['dag_nummer'];
    $maand = $_POST['maand'];
    $tijd = $_POST['tijd'];
    $opmerking = $_POST['opmerking'];
    $newsletter = $_POST['newsletter'];

    $_SESSION['aanhef'] = $aanhef;
    $_SESSION['name'] = $name;
    $_SESSION['email'] = $email;
    $_SESSION['adres'] = $adres;
    $_SESSION['postcode'] = $postcode;
    $_SESSION['woonplaats'] = $woonplaats;
    $_SESSION['telefoon'] = $telefoon;
    $_SESSION['dag'] = $dag;
    $_SESSION['dag_nummer'] = $dag_nummer;
    $_SESSION['maand'] = $maand;
    $_SESSION['tijd'] = $tijd;
    $_SESSION['opmerking'] = $opmerking;
    $_SESSION['newsletter'] = $newsletter;

    if (empty($name) || empty($email) || empty($telefoon) || empty($tijd)) {

        if (empty($name)) {
            $errors[] = "name";
        }

        if (empty($email)) {
            $errors[] = "email";
        }

        if (empty($telefoon)) {
            $errors[] = "telefoon";
        }

        if (empty($tijd)) {
            $errors[] = "tijd";
        }

        header("Location: afspraak.php?error[]=" .implode('&error[]=', $errors));
        exit;
} else {

// send mail if (post) parameters are correct
if (mail(
    'tim-luijten@hotmail.com', 
    'Afsprakenformulier o-vita.nl', 
    "Er is contact opgenomen via het afsprakenformulier. Zie onderstaande gegevens: \n\n
    Naam: {$aanhef} {$name} \n
    E-mailadres: {$email} \n
    Adres: {$adres} \n
    Postcode: {$postcode} \n
    Woonplaats: {$woonplaats} \n
    Telefoonnummer: {$telefoon} \n
    Datum: {$dag} {$dag_nummer} {$maand} \n
    Tijd: {$tijd} \n
    Opmerking: {$opmerking} \n
    Nieuwsbrief ontvangen: {$newsletter} \n"         
                ,
    "From: {$email} \r\n"
  ))
 {
     $_SESSION['aanhef'] = "";
     $_SESSION['name'] = "";
     $_SESSION['email'] = "";
     $_SESSION['adres'] = "";
     $_SESSION['postcode'] = "";
     $_SESSION['woonplaats'] = "";
     $_SESSION['telefoon'] = "";
     $_SESSION['dag'] = "";
     $_SESSION['dag_nummer'] = "";
     $_SESSION['maand'] = "";
     $_SESSION['tijd'] = "";
     $_SESSION['opmerking'] = "";
     $_SESSION['newsletter'] = "";

     header("Location: bedankt_afspraak.php");
        exit;
           } else {
    //display a message that the message failed to send.
   }
}

    }



header("Location: afspraak.php");

?>

I currently have it like this:

    <?php $days = array(
    1 => 1,
    2 => 2,
    3 => 3,
etc
etc
    // ...
);

echo '<select name="dag_nummer" type="text" class="text_dag_nummer">' . "\n";

foreach ($days as $value => $text) {
    echo '<option value="' . $value . '"';

    if (isset($_POST['dag_nummer']) && $_POST['dag_nummer'] == $value) {
        echo ' selected="selected"';
    }


    echo '>' . $text . "</option>\n";

}

echo "</select>\n";
 ?>

However, It still displays the selected value after the dropdown boxes, instead of the desired value being selected…
See my screenshot: http://piclair.com/data/gpjal.jpg

  • 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-28T04:13:15+00:00Added an answer on May 28, 2026 at 4:13 am

    It looks like you want to have the error page show the user’s previously selected options for the drop-downs. This should be done using the following:

    <option value="10" selected="selected">10</option>
    

    You will need to handle this selection programatically:

    $days = array(
        1 => 1,
        // ...
    );
    
    echo '<select name="dag_nummer" type="text" class="text_dag_nummer">' . "\n";
    
    foreach ($days as $value => $text) {
        echo '<option value="' . $value . '"';
    
        if (isset($_POST['dag_number']) && $_POST['dag_number'] == $value) {
            echo ' selected="selected"';
        }
    
        echo '>' . $text . "</option>\n";
    
    }
    
    echo "</select>\n";
    

    This should replace your echo (isset($_SESSION['dag_number'])) ... logic.

    Also note the structure of the <select> element that this constructs — with the <option> elements nested inside it.

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

Sidebar

Related Questions

I have problem compilin this code..can anyone tell whats wrong with the syntax CREATE
I have problem with fancybox. I want to write a function that will run
I have a small problem. I am creating an appointment table where in the
Have problem while getting data from Memcached on .NET MVC solution. I have this
I have problem with jCaret plugin in IE. jCaret downloads I want to get
We're running SQL 6.5 though ADO and we have the oddest problem. This sentence
I'm writing an application where the user will create an appointment, and instantly get
I have problem with this method in NLog library: NLog.Targets.Wrappers.AsyncTargetWrapper.ProcessPendingEvents(object state) It consume too
I have problem with passing variables through views. But, first some code // i
I have problem with configuring NODE.JS. I was trying to install node.js with this

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.