Not signed in (Sign In)

SkillShare - A place to discuss Web Standards and Web Design topics

Categories

Vanilla 1.1.9 is a product of Lussumo. More Information: Documentation, Community Support.

    • CommentAuthorSkorpion
    • CommentTimeMar 26th 2006
     permalink
    Hey all :-)

    I've been working with Web Standards for a while now and looking at converting my site from XHTML Transitional to XHTML Strict. However, in XHTML Strict, from what I can work out, you can't use the 'name' element for <input> fields anymore...

    So, how can you access, for example, $_POST['foo']?

    I've got the following form but it doesn't register the 'id' element inside the $_POST variable:


    <?php

    if(isset($_POST['blah'])) {
    echo $_POST['blah'];
    }

    ?>

    <html>
    <head>
    <title>Skorpion</title>
    </head>
    <body>
    <div id="tst">
    <form method="post" action="<?php echo $_SERVER['SCRIPT_NAME'] ?>">
    <input type="text" id="blah" />
    <input type="submit" value="Click Me!" />
    </form>
    </div>
    </body>
    </html>


    Any suggestions would be HUGELY appreciated.

    Allan
    • CommentAuthorNick Presta
    • CommentTimeMar 26th 2006 edited
     permalink
    You can use the name attribute in input fiels in XHTML strict.
    Also, PHP doesn't hook on to things with ID attributes.

    Even in true XHTML (1.1, the most strict), you can use the name attribute.

    Example:
    http://nickpresta.ath.cx/source/xhtmlwithname.php
    • CommentAuthorljromanoff
    • CommentTimeMar 29th 2006
     permalink
    What about the use of the name attribute on a form tag?
    • CommentAuthorKanashii
    • CommentTimeMar 29th 2006
     permalink
    You don't need a name attribute on the form. Use ID for either anchoring or scripting purposes
    • CommentAuthorljromanoff
    • CommentTimeMar 29th 2006
     permalink
    That doesn't actually answer my question.
    • CommentAuthorKanashii
    • CommentTimeMar 29th 2006
     permalink
    Oh sorry. No you cant use name on the form element : )
    • CommentAuthorismo
    • CommentTimeMar 29th 2006
     permalink
    <input type="text" name="blaah" id="something" />

    And

    echo $_POST["blaah"];
    • CommentAuthorKanashii
    • CommentTimeMar 29th 2006
     permalink
    name="blaah" id="blaah" Just to be pedantic : )
    • CommentAuthorljromanoff
    • CommentTimeMar 30th 2006
     permalink
    Thanks, Kanashii. The W3 validator was giving me errors on name within form (which I expected), but numerous sites claim that it's actually valid.
Add your comments
    Username Password
  • Format comments as (Help)