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

PHP

MULLY BENDET
MULLY BENDET
509 Points

why did it not work

<?php include_once 'index.php'; $name = $_POST['name']; $email = $_POST['email']; $address = $_POST['address']; $date = $_POST['date']; $otherinfo = $_POST['otherinfo']; $notes = $_POST['notes']; $garment = $_POST['garment']; $shortenslleeves = $_POST['shortensleeves']; $relsecollar = $_POST['relsecollar']; $takeinsides = $_POST['takeinsides']; $shortencoat = $_POST['shortencoat']; $movebuttons = $_POST['movebuttons']; $padshulders = $_POST['padshulders']; $lengthensleeves = $_POST['lengthensleeves']; $letoutsides = $_POST['letoutsides']; $sinkseye = $_POST['sinkseye']; $lowercollar = $_POST['lowercollar']; $chest = $_POST['chest']; $waistvest = $_POST['waistvest']; $waisttrosers = $_POST['waisttrosers']; $length = $_POST['length']; $knee = $_POST['knee']; $bottom = $_POST['bottom']; $whithcuffs = $_POST['whithcuffs']; $thigh = $_POST['thigh']; $finhem = $_POST['finhem']; $whithoutcuffs = $_POST['whithoutcuffs']; $shatnes = $_POST['shatnes'];

$sql = "INSERT INTO new alerathion form (name, email, address, date, other info, notes, garment, shorten slleeves, relse collar, shorten coat, take in, sides, move buttons, pad shulders, lengthen sleeves, let out sides, sink, seye, lower collar, chest, waist-vest, waist-trosers, length, knee, bottom, whith cuffs, thigh, fin hem, whithout cuffs, shatnes) VALUES ('$name', '$email', '$address , '$date', '$otherinfo', '$notes', '$garment', '$shortenslleeves','$relsecollar', '$shortencoat', '$takeinsides', '$movebuttons', '$padshulders', '$lengthensleeves', '$letoutsides', '$sinkseye', '$lowercollar', '$chest', '$waistvest', '$waisttrosers', '$length', '$knee, $bottom','$whithcuffs', '$thigh', '$finhem', '$whithoutcuffs', '$shatnes');";

mysqli_query($conn, $sql);

MULLY BENDET
MULLY BENDET
509 Points

here is index.php

<?php $servername = "localhost"; $username = "root"; $password = ""; $dbname = "new-alteration-tag";

// Create connection

$conn = new mysqli($servername, $username, $password, $dbname);

MULLY BENDET
MULLY BENDET
509 Points

here is my html file

<!DOCTYPE html>

<html lang="en" xmlns="http://www.w3.org/1999/xhtml"> <head>

<meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <meta name="description" content=""> <meta name="author" content="">

<title>Resume - Start Bootstrap Theme</title>

<!-- Bootstrap core CSS -->
<link href="vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet">

<!-- Custom fonts for this template -->
<link href="https://fonts.googleapis.com/css?family=Saira+Extra+Condensed:100,200,300,400,500,600,700,800,900" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Open+Sans:300,300i,400,400i,600,600i,700,700i,800,800i" rel="stylesheet">
<link href="vendor/font-awesome/css/font-awesome.min.css" rel="stylesheet">
<link href="vendor/devicons/css/devicons.min.css" rel="stylesheet">
<link href="vendor/simple-line-icons/css/simple-line-icons.css" rel="stylesheet">

<!-- Custom styles for this template -->
<link href="css/resume.min.css" rel="stylesheet">

</head>

<body>

<form action="code.php" method="POST">

    <!-- /////////////////////////////////////////////

    prsinal info


//////////////////////////////////////////////////////-->
<h1>persinal info</h1>

name:<br> <input type="text" name="name"> <br>

email:<br>
<input type="text"id="email" name="email">
<br>

adress:<br>
<input type="text" name="address">
<br>

    <!-- /////////////////////////////////////////////


other info

//////////////////////////////////////////////////////-->

<h1>other info</h1> date:<br> <input type="date" name="date"> <br>

other info:<br> <input type="text" name="otherinfo"> <br>

notes:<br> <input type="text" name="notes"> <br>

      garment:<br>
      <input type="text" name="garment">
      <br>
    <!-- /////////////////////////////////////////////


    coat

//////////////////////////////////////////////////////-->

<h1>coat</h1> shorten sleeves:<br> <input type="text" name="shortensleeves"> <br>

      relse collar:<br>
      <input type="text" name="relsecollar">
      <br>


      shorten coat:<br>
      <input type="text" name="shortencoat">
      <br>

      take in sides:<br>
      <input type="text" name="takeinsides">
      <br>

      move buttons:<br>
      <input type="text" name="movebuttons">
      <br>

      pad shulders:<br>
      <input type="text" name="padshulders">
      <br>

    lengthen sleeves:<br>
      <input type="text" name="lengthensleeves">
      <br>

      let out sides:<br>
      <input type="text" name=" letoutsides">
      <br>

      sink seye:<br>
      <input type="text" name="sinkseye">
      <br>

      lower collar:<br>
      <input type="text" name="lowercollar">
      <br>
<!-- /////////////////////////////////////////////


vest

//////////////////////////////////////////////////////-->


      <h1>vest</h1>

      chest:<br>
      <input type="text" name="chest">
      <br>


     waist:<br>
      <input type="text" name="waistvest">
      <br>

      <!-- /////////////////////////////////////////////


    trousers

//////////////////////////////////////////////////////-->



    <h1>Trousers</h1> <br>
    waist:<br>
    <input type="text" name="waisttrosers">
    <br>






    length:<br>
    <input type="text" name="length">
    <br>






    knee:<br>
    <input type="text" name="knee">
    <br>





    bottom:<br>
    <input type="text" name="bottom">
    <br>



    whith cuffs:<br>
    <input type="text" name="whithcuffs">
    <br>

    thigh:<br>
    <input type="text" name="thigh">
    <br>

    fin. Hem:<br>
    <input type="text" name="finhem">

    <br>
    whithout Cuffs:<br>
    <input type="text" name="whithoutcuffs">
    <br>
    shatnes: <br>
    <input type="text" name="shatnes" value="yes/no">

<button onclick="myFunction()">Print</button> <button onclick="myFunction1();">send email</button> <button type="submit" name="submit">save</button> </form> <script>

  function myFunction1() {
    var input = document.getElementById('email');
    email = input.value;

    window.open("mailto:" + email + "?subject=" + subject);
  }




function myFunction() 

{window.print();

}

</script>

</body> </html>

<nav class="navbar navbar-expand-lg navbar-dark bg-primary fixed-top" id="sideNav"> <a class="navbar-brand js-scroll-trigger" href="#page-top"> <span class="d-block d-lg-none">Start Bootstrap</span> <span class="d-none d-lg-block"> <img class="img-fluid img-profile rounded-circle mx-auto mb-2" src="img/profile.jpg" alt=""> </span> </a> <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation"> <span class="navbar-toggler-icon"></span> </button> <div class="collapse navbar-collapse" id="navbarSupportedContent"> <ul class="navbar-nav"> <li class="nav-item"> <a class="nav-link js-scroll-trigger" href="talor.html">talor</a> </li> <li class="nav-item"> <a class="nav-link js-scroll-trigger" href="newalterationtag.html">new alteration tag</a> </li> <li class="nav-item"> <a class="nav-link js-scroll-trigger" href="histery.html">histery</a> </li>

    </ul>
  </div>
</nav>

</body> </html>

1 Answer

Niki Molnar
Niki Molnar
25,698 Points

Hi Mully

It would be helpful to know what isn’t working and what error messages you’re getting but there are a few issues I’ve noticed at a glance.

Most of your $_POST at the top don’t have the underscore, so say $POST. Your JavaScript doesn’t declare the variable email (you need to state “var email = ...”) and you’re not passing a subject to the function anywhere.

Have a look at error messages or error log to see what they say.

Hope that’s been a little helpful but it wasn’t easy to read :-)

Niki