Monday, 15 March 2010

if statement - PHP-How to check if the textbox contains one word or two? -


Now I want to check if there is one or two words in this text box, for example

  if ($ _POST ['mytext'] == two words) {echo "this is absolutely correct"; } And {echo "we do not accept it"; }   

and I tried

  if ($ _POST ['mytext']> 1) {echo "this is absolutely correct"; } And {echo "we do not accept it"; }   

And it is not working

This means how do I create it?

Thanks

If you define < two words < You can do something like: $ mytext = $ _POST [/ em> as "some letters after a few letters" in the form of Mytext "]; $ Parts = explosion ("", $ mytext); If (count ($ parts)! == 2) {New exception throw ("too much or too little!"); } If (strollen ($ parts [0]) === 0 || strollen ($ parts [1]) === 0 {throwing new exception ("not enough characters!"); }

Keep in mind that "@!"

No comments:

Post a Comment