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

marcell gibbs
marcell gibbs
3,744 Points

errors on line 8 and 9?

When i run this code i get errors on line 8 and 9 i cant figure out why?

heres the code:

<?php require 'inc/functions.php';

$pageTitle = "Project | Time Tracker"; $page = "projects";

If($_SERVER['REQUEST_METHOD'] == 'POST') { $title = trim(filter_input(INUPT_POST, 'title', FILTER_SANITZE_STRING)); $category = trim(filter_input(INUPT_POST, 'Category', FILTER_SANITZE_STRING));

if(empty($title) || empty($category)){ $error_message = "please fill in the required fields : Tiltle, Category"; }else{ echo "title = $title<br />"; echo "category = $category<br />"; }

} include 'inc/header.php'; ?>

<div class="section page"> <div class="col-container page-container"> <div class="col col-70-md col-60-lg col-center"> <h1 class="actions-header">Add Project</h1> <?php if (isset($error_message)){ echo "<p class='message'>$error_message</p>"; }

      ?>

and the error:

Notice: Use of undefined constant INUPT_POST - assumed 'INUPT_POST' in /home/treehouse/workspace/project.php on line 8

Notice: Use of undefined constant FILTER_SANITZE_STRING - assumed 'FILTER_SANITZE_STRING' in /home/treehouse/workspace/project.php on line 8

Warning: filter_input() expects parameter 1 to be integer, string given in /home/treehouse/workspace/project.php on line 8

Notice: Use of undefined constant INUPT_POST - assumed 'INUPT_POST' in /home/treehouse/workspace/project.php on line 9

Notice: Use of undefined constant FILTER_SANITZE_STRING - assumed 'FILTER_SANITZE_STRING' in /home/treehouse/workspace/project.php on line 9

Warning: filter_input() expects parameter 1 to be integer, string given in /home/treehouse/workspace/project.php on line 9

1 Answer

You see:

Notice: Use of undefined constant INUPT_POST

because the constant is: INPUT_POST

You see:

Notice: Use of undefined constant FILTER_SANITZE_STRING 

because the constant is: FILTER_SANITIZE_STRING