Jump to content

php code isn't getting executed,only the code in form tags are?


Go to solution Solved by Ch0cu3r,

Recommended Posts

<?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>
   

  • Solution

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

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:
 
More information about the accessibility of the <label> tag can be found here:

 

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.