snb2990 Posted August 28, 2015 Share Posted August 28, 2015 <?php if (isset($_POST['name'])&&isset($_POST['password'])) { $name= $_POST['name']; $password= $_POST['password']; if(!empty($name)&&!empty($password)) { echo 'ok'; } else { echo 'please enter all fields'; } } ?> <form action="new.php" method="POST"> Name: <input type="text" name="Name"> password: <input type="password" name="password"></br> <p></p> <input type="submit" name="submit" value="submit"> </form> Quote Link to comment Share on other sites More sharing options...
Solution Ch0cu3r Posted August 28, 2015 Solution Share Posted August 28, 2015 Most likely because you have named your name input field Name but in your code your checking to see if $_POST['name'] exists (or in other words a field called name ) Field names are case sensitive. Name is not the same as name Quote Link to comment Share on other sites More sharing options...
cyberRobot Posted August 28, 2015 Share Posted August 28, 2015 Side note: Surrounding form labels and form fields with <label> tags improves the accessibility of your website to visitors using assistive technologies like screen readers. <label>Name: <input type="text" name="name"></label> <label>password: <input type="password" name="password"></label> More information about the <label> tag can be found here: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/label More information about the accessibility of the <label> tag can be found here: http://webaim.org/techniques/forms/controls Quote Link to comment Share on other sites More sharing options...
QuickOldCar Posted August 28, 2015 Share Posted August 28, 2015 Side note: Surrounding form labels and form fields with <label> tags improves the accessibility of your website to visitors using assistive technologies like screen readers. Since not everyone does this and optional...I feel screenreaders should be using DOM or alternate methods to locate tags and their id,names,values...such as if no <label> present use it's name or value. On a side note: webaim and most likely others require adobe shockwave player which is an NPAPI plugin NPAPI plugins don't work on Chrome version 42 and higher so need to enable it. https://support.google.com/chrome/answer/6213033 Quote Link to comment 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.