Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Bedeho Mender
4,498 PointsStuck at "Working with GET Variables"
Here is my code: <?php
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$name = $_POST["name"];
$email = $_POST["email"];
$beskjed = $_POST["beskjed"];
$email_body = "";
$email_body = $email_body . "Navn: " . $email . "\n";
$email_body = $email_body . "Navn: " . $name . "\n";
$email_body = $email_body . "Epost: " . $email . "\n";
$email_body = $email_body . "Beskjed: " . $beskjed . "\n";
// Send email
header("Location: contact.php?status=thanks");
exit;
} ?>
<?php
$pageTitle = "Kontakt Mike"; $section = "contact";
include("inc/header.php"); ?>
<div class="section page">
<div class="wrapper">
<h1>Kontakt</h1>
<?php if (isset($_GET["status"]) AND $_GET["status"] == "thanks") { ?>
<p> I`d love to hear from you ! Complete the form to send me an email.</p>
<? php } else { ?>
<p> Ta gjerne kontakt pƄ epost </p>
<form method="post" action="contact.php">
<table>
<tr>
<th>
<label for="name">Name</label>
</th>
<td>
<input type="text" name="name" id="name">
</td>
</tr>
<tr>
<th>
<label for="email">Email</label>
</th>
<td>
<input type="text" name="email" id="email">
</td>
</tr>
<tr>
<th>
<label for="beskjed">Send oss en beskjed</label>
</th>
<td>
<textarea name="beskjed" id="beskjed"></textarea>
</td>
</tr>
</table>
<input type="submit" value="Send">
</form>
<?php } ?>
</div>
<?php include("inc/footer.php"); ?>
It just goes blank, here is a screenshot of what I see.http://imgur.com/IhdHlMr
1 Answer
Hass Beydoun
8,625 PointsCheck if you have a syntax error in your text editor. I can not tell from looking at the code