Eruondo Posted January 3, 2010 Posted January 3, 2010 I'm trying to do a form, and in that form, I've put in a little snippet to ensure that my users actually have written something in the fields. I've used these two codes, if ($_GET['header'] == 0) { die( "You did not fill out all forms."); } and if (!isset($_GET['header'])) { print "You did not fill out all forms."; } Bu neither of them works! The first code activates no matter what I write in the header field, and the second one never does... I'm sincerely stuck, and would greately appriciate any help! What am I doing wrong? I'm betting it's something really stupid and easy. Quote
iSOS Posted January 3, 2010 Posted January 3, 2010 You should post your actual form. Looking at those 'snippets', they look okay. Are you sure you're using "$_GET" as the form method?, or are you actually using "$_POST"? Quote
jon182 Posted January 3, 2010 Posted January 3, 2010 Just do $length=strlen($_GET['header']); if ($length == 0) die ("You must input something"); else { code } Quote
Eruondo Posted January 4, 2010 Author Posted January 4, 2010 You should post your actual form. Looking at those 'snippets', they look okay. Are you sure you're using "$_GET" as the form method?, or are you actually using "$_POST"? No, it's get. But that code from jon182 fixed it, so thanks! Case closed, :P Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.