How do I insert dropdown menu?

I have made a dropdown menu in my php code. But when I press submit it doenst submit the value. I chose varchar.

makes no sense, you are just mixing up different contexts. show code.

When I try to paste the code it is showing a preview how do I ignore that?

Just ignore the preview? Most people want to see what their post will actually look like, if you don’t care then don’t look.

<?php include ('connectie.php')?>
<!DOCTYPE html>
<html lang="nl">
<head>
    <title>BetalingsPeriode</title>
    <link rel="stylesheet" type="text/css" href="test.css">
</head>
<body>
<div class="contactgegevens">
    <table>
    <thead>
    <tr>
        <th>Naam</th>
        <th>Achternaam</th>
        <th>Bedrijfsnaam</th>
        <th>Adres</th>
        <th>Postcode</th>
        <th>Woonplaats</th>
        <th>Telefoon</th>
        <th>E-mail</th>
    </tr>
    </thead>
    <tbody>
    <?php while ($row = mysqli_fetch_array($results)){ ?>
            <td><?php echo $row['Naam']?></td>
            <td><?php echo $row['Achternaam']?></td>
            <td><?php echo $row['Bedrijfsnaam']?></td>
            <td><?php echo $row['Adres']?></td>
            <td><?php echo $row ['Postcode']?></td>
            <td><?php echo $row['Woonplaats']?></td>
            <td><?php echo $row['Telefoon']?></td>
            <td><?php echo $row['Email']?></td>
    </tbody>
    <?php } ?>
    </table>
</div>
<form method="post" action="connectie.php">
<div class="contact-form">
    <label for="Betalingsperiode">Betalingsperiode</label>
    <select id="Betalingsperiode">
        <option value="Kies betalingsperiode">Kies betalingsperiode</option>
        <option value="1 Dag">1 Dag</option>
        <option value="1 Week">1 Week</option>
        <option value="1 Maand">1 Maand</option>
        <option value="1 Jaar">1 Jaar</option>
    </select>
</div>
<div class="contact-form">
    <label for="Bedrag per periode">Bedrag per periode</label>
    <input type="text" name="Bedragperperiode" placeholder="Bedrag per periode">
    <input type="submit" name="Opslaan" value="Opslaan">
</div>
</form>
<div class="contact-form">
    <th>Betaling overzicht
        <tr>Openstaand</tr>
        <tr>Betaald</tr>
    </th>
</div>
</body>
</html>

This is what happens…

The element has no name, so it will not be able to be accessed by PHP

I feel so noob now hahahaha thankyou men!!

Will it insert the value because I chose the type : varchar?

Test it.

That isn’t how I would suggest it, however.

It gives me this error : Error: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘Week, 100)’ at line 1

Seems you have an error in your SQL. I haven’t seen any SQL in this thread so far.
Submitting a form doesn’t automagically insert stuff into a database. There is something between the HTML form and the database that does the actual insert.

What talks to your database and what does the SQL look like that causes your error?

I have fixed the problem, thankyou guys.

Sponsor our Newsletter | Privacy Policy | Terms of Service