nathanmaxsonadil Posted August 17, 2007 Share Posted August 17, 2007 my login script wont output the error Here's the code <?php $title = 'Swap Invites - Register'; include 'header.php'; include('./config.php'); $divs = '<div style="clear: both;"> </div></div>'; function forum() { echo "<div id='content'> <div id='columnA'><h2>Register</h2><br/>"; if(isset($error)) { echo $error; } echo "<br/><form method='post'> username:<br/> <input type='text' name='username' /> <br /> email:<br/> <input type='text' name='email' /> <br /> password:<br/><input type='password' name='password' /> <br/> retype password:<br/><input type='password' name='password2' /> <br/> <input type='submit' name='submit' value='Submit' /> </form></div> "; } if(empty($_POST)) { forum(); include 'sidebar.php'; echo $divs; include 'footer.php'; exit(); } if(isset($_POST[submit])) { if(strlen($_POST[username]) > '16') { $error = "you username is too long! it has to be less than 16 chachters!"; forum(); include 'sidebar.php'; echo $divs; include 'footer.php'; exit(); }//and so on.... When you enter too long a username it is supposed to echo a error telling you have to have a shorter username however it just display's the normal thing Quote Link to comment https://forums.phpfreaks.com/topic/65337-problems-with-my-register-script/ Share on other sites More sharing options...
trq Posted August 17, 2007 Share Posted August 17, 2007 Integers are NOT supposed to be surrounded by quotes (making them strings). if(strlen($_POST[username]) > '16') { Should be.... if(strlen($_POST[username]) > 16) { Also note that non numeric array indexes need quotes, so the line really ought be.... if(strlen($_POST['username']) > 16) { Quote Link to comment https://forums.phpfreaks.com/topic/65337-problems-with-my-register-script/#findComment-326286 Share on other sites More sharing options...
nathanmaxsonadil Posted August 17, 2007 Author Share Posted August 17, 2007 ok thanks Quote Link to comment https://forums.phpfreaks.com/topic/65337-problems-with-my-register-script/#findComment-326295 Share on other sites More sharing options...
nathanmaxsonadil Posted August 17, 2007 Author Share Posted August 17, 2007 that did'nt fix it ??? Quote Link to comment https://forums.phpfreaks.com/topic/65337-problems-with-my-register-script/#findComment-326299 Share on other sites More sharing options...
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.