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 Build a Basic PHP Website (2018) Adding a Basic Form Form Validation

Luca Mori
Luca Mori
2,374 Points

The function strpos is looking for the string "Content-Type", in my $_POST array? i don't get this.

From a test in the PHP section , i found this function : strpos( $array, 'Content-Type' ). As this is inside a foreach loop, and the array is the _POST, i tough it was looking for any instance of my array, to find any value containing that string, but i was wrong.

foreach( $_POST as $value ){

if( stripos($value,'Content-Type:') !== FALSE ){

   echo "There was a problem with the information you have entered.";

    exit();

}

}

Luca Mori
Luca Mori
2,374 Points

could someone tell me as well witch kind of tag i must use to display code in my questions? i tried the pre tag but is not working.

Rifqi Fahmi
Rifqi Fahmi
23,164 Points

From the code I look, maybe you type stripos not strpos ??? check your code again

Hi Luca,

Check this thread for posting code: https://teamtreehouse.com/forum/posting-code-to-the-forum

1 Answer