0

I have hit a snag getting a simple html form to send some values to a php script. This form and script were at once point working, but now i have no idea what is going on. I did have some silly value naming issues, but since rectifying those, its still just as broken.

Here is the form:

<form action="form-to-email.php" method="POST">

Hey Luke!<br><br>
My name is <input type="text" name="name" placeholder="your name">. I like your work.  I'm looking for someone to to fill a position with skills in the following areas:<br><br> 

<div class="checkboxes">
  <div class="leftcheckboxes">
      <input  type="checkbox" name="skillneeded" value="uxdesign">UX Design<br>
      <input type="checkbox" name="skillneeded" value="uidesign">UI Design<br>
      <input type="checkbox" name="skillneeded" value="interactiondesign">IxD<br>
  </div>
  <div class="rightcheckboxes">
      <input  type="checkbox" name="skillneeded" value="graphicdesign">Graphics<br>
      <input type="checkbox" name="skillneeded" value="webanimation">Web Animation<br>
      <input type="checkbox" name="skillneeded" value="frontend">Front End<br><br>
  </div>
</div>

Let me know if you'd like to come in to talk shop and discuss your eligibility for the position further in person. <br><br>

<textarea name="furtherdetails" placeholder=" further information" cols="40" rows="7"></textarea><br><br>
You can reach me at <input type="text" name="email" placeholder="your email">
<br><br><br>
<div class="submitbuttwrapper">
    <input type="submit" value="Submit">
</div>
</form>

And here is the php script

<?php

error_reporting(-1);
ini_set('display_errors', 'On');
set_error_handler("var_dump");

//grab the values posted to the header and put them in vars
$name = $_POST['name'];
$furtherdetails = $_POST['furtherdetails'];
$email = $_POST['email'];
$skills = nl2br(implode(',', $_POST['skillneeded']));


$email_from = "$email";

$email_subject = "new form submission";

$email_body = "You received a new message from $name.\n\n".
              "$furtherdetails.\n\n".
              "$email.\n\n".
              "$skills";

$to = "luke.ryckman@gmail.com";

$headers = "From: $email \r\n";

mail($to, $email_subject, $email_body, $headers);
header('Location: http://www.lukeryckman.ca/thank-you.html');
?>

I have no idea why this isn't working when it once did - any help appreciated. Thank you.

  • you have no name attribute for `skillneeded`. You're looking for `vehicle`. – Funk Forty Niner Nov 21 '16 at 15:52
  • You need to set `method="POST"` in your form tag to send via POST. Default is GET. – Jonnix Nov 21 '16 at 15:53
  • I noticed that the lack of POST too, but couldn't imagine deleting that from the working version, and assumed default was GET, especially since the names were in the url after hitting submit (with blank values) I now added it in and it is now grabbing and sending me the values- thank you. It still redirects to an error page after submitting, but is sending the values. – Luke Ryckman Nov 21 '16 at 16:04

0 Answers0