Pieter Pieter - 2 months ago 9
PHP Question

PHP form on submit gives HTTP error 500

I have a PHP form with a submit button in my html.
However when I press the submit button my browser gives an error -> HTTP error 500.

I am using the same type of PHP form on other sites and there it works fine... Anybody sees the problem here?

Form and HTML in snippet below.

<?php

$lidworden = $_POST['lidworden']
$projectsponsoring = $_POST['projectsponsoring'];
$leo = $_POST['leo'];
$lion = $_POST['lion'];
$andere = $_POST['andere'];
$naam = $_POST['naam'];
$email = $_POST['email'];
$bericht = $_POST['bericht'];

$to = "info@pieterswebdesign.com";
$subject = "Leo Club de 4 Ambachten";
$body = "Dit is een automatisch bericht gelieve hier niet op te reageren. \n\n $lidworden,$projectsponsoring,$leo,$lion,$andere,$Naam,$Email,$Telefoon,$Bericht";

mail($to,$subject,$body);
header("Location: index.html");

exit();
?>


<form id="form" action="send.php" method="POST">

<p id="radiotitle"><span class="bluetxt">Je bent</p>

<div id="radiodiv">
<label class="label">
<input type="radio" name="lidworden" value="lidworden" />geïnteresseerd om lid te worden
</label>
<label class="label">
<input type="radio" name="projectsponsoring" value="projectsponsoring" />geïnteresseerd in projectsponsoring
</label>
<label class="label">
<input type="radio" name="leo" value="leo"/>een Leo
</label>
<label class="label">
<input type="radio" name="lion" value="lion"/>een Lion
</label>
<label class="label">
<input type="radio" name="andere" value="andere"/>andere
</label>
</div>

<div id="textdiv">
<label class="label2">Je naam</label>
<input type="text" name="naam" placeholder="Typ hier..." />

<label class="label2">Je e-mailadres</label>
<input type="text" name="email" placeholder="Typ hier..." />

<label class="label2">Je bericht</label>
<textarea type="text" name="bericht" value="bericht" placeholder="Typ hier..."></textarea>

<button type="submit" id="sendbutton"><p>VERSTUUR</p></button>
</div>
</form>

Answer

Typos:

<?php

$lidworden = $_POST['lidworden']
                                ^---missing ;

causing a fatal parse error... Since you obviously didn't see the error message, you're running with display_errors and error_reporting disabled. They should NEVER be off on a devel/debug system. It's the equivalent of stuffing your fingers in your ears and going "lalalala can't hear you".