I have been working on a madlibs program, and it has been breaking for no reason it seems like. I take user input from an html form. I am trying to check if the user input is valid. In order for the data to be valid, the data must NOT contain a space, or any punctuation character. I am not sure if I should use the strpos command, or preg_match. Anyway I am able to get to the first if statement, and it breaks. I have used multiple variations of this command, and no matter what I do my code seems to break. All I am trying to do is check if this consolidated string contains a single char. It seems simple enough, but I cannot seem to find the issue. Any responses would be greatly appreciated. I can post the code from my html page, but the problem does not lie in that code.
<?php
//Michael Keller
//Project1
//Variables
$stringFirstVerb = $_POST["stringFirstVerb"];
$stringSecondVerb = $_POST["stringSecondVerb"];
$stringThirdVerb = $_POST["stringThirdVerb"];
$stringFirstNoun = $_POST["stringFirstNoun"];
$stringSecondNoun = $_POST["stringSecondNoun"];
$stringThirdNoun = $_POST["stringThirdNoun"];
$stringFirstAdj = $_POST["stringFirstAdj"];
$stringSecondAdj = $_POST["stringSecondAdj"];
$stringThirdAdj = $_POST["stringThirdAdj"];
$stringParagraph = $_POST["stringParagraph"];
$intNounCount = 0;
$intVerbCount= 0;
$intAdjCount = 0;
//check for user input
$stringNewStr = implode("",array($stringFirstVerb,$stringSecondVerb,
$stringThirdVerb,$stringFirstNoun,$stringSecondNoun,$stringThirdNoun,
$stringFirstAdj,$stringSecondAdj,$stringThirdAdj));
var_dump($stringNewStr);
if( strpos($stringNewStr, ' ' ) !== false ){
echo "No spaces allowed in any Verbs, Nouns, or Adj's";
echo "<br>";
echo "<a href="project1.html">Link to previous Page</a>";
}
?>