creating html page

Discussion in 'HTML' started by wes, Apr 7, 2006.

  1. wes

    wes Guest

    How do you dynamically create a web page. If i ask the user to enter a
    name, then the html document must be created with the name that the
    user entered as the name of the document.

    Thanks Wes
    wes, Apr 7, 2006
    #1
    1. Advertising

  2. wes

    Neredbojias Guest

    To further the education of mankind, "wes" <> declaimed:

    > How do you dynamically create a web page. If i ask the user to enter a
    > name, then the html document must be created with the name that the
    > user entered as the name of the document.


    Do you mean the file name of the document or title of the document? If the
    latter, a little php makes it a cinch.

    --
    Neredbojias
    Infinity can have limits.
    Neredbojias, Apr 7, 2006
    #2
    1. Advertising

  3. wes

    wes Guest

    the actual filename
    wes, Apr 7, 2006
    #3
  4. wes

    Arjen Guest

    wes wrote:
    > How do you dynamically create a web page. If i ask the user to enter a
    > name, then the html document must be created with the name that the
    > user entered as the name of the document.
    >
    > Thanks Wes
    >


    All sots of ways to do this but all involve server side scripting. Why
    dont u try alt.php ?

    Btw I'd immediately name myself ../index.php just to see if it would
    work :)

    arjen
    Arjen, Apr 7, 2006
    #4
  5. wes

    Toby Inkster Guest

    Neredbojias wrote:
    > "wes" <> declaimed:
    >
    >> How do you dynamically create a web page. If i ask the user to enter a
    >> name, then the html document must be created with the name that the
    >> user entered as the name of the document.

    >
    > Do you mean the file name of the document or title of the document? If the
    > latter, a little php makes it a cinch.


    The former ain't much harder:

    ====================================================
    <?php
    # call this file "foo.php".

    if (strlen($_SERVER['PATH_INFO']))
    {
    print "This is {$_SERVER['PATH_INFO']}";
    exit;
    }
    elseif (strlen($_GET['name']))
    {
    header("Location: foo.php/{$_GET['name']}");
    exit;
    }
    ?>
    <form action="foo.php" method="get">
    <input name="name">
    <input type="submit">
    </form>
    ====================================================

    and then visit foo.php.

    --
    Toby A Inkster BSc (Hons) ARCS
    Contact Me ~ http://tobyinkster.co.uk/contact
    Toby Inkster, Apr 7, 2006
    #5
  6. wes

    Neredbojias Guest

    To further the education of mankind, Toby Inkster
    <> declaimed:

    >> Do you mean the file name of the document or title of the document?
    >> If the latter, a little php makes it a cinch.

    >
    > The former ain't much harder:
    >
    > ====================================================
    > <?php
    > # call this file "foo.php".
    >
    > if (strlen($_SERVER['PATH_INFO']))
    > {
    > print "This is {$_SERVER['PATH_INFO']}";
    > exit;
    > }
    > elseif (strlen($_GET['name']))
    > {
    > header("Location: foo.php/{$_GET['name']}");
    > exit;
    > }
    > ?>
    > <form action="foo.php" method="get">
    > <input name="name">
    > <input type="submit">
    > </form>
    > ====================================================
    >
    > and then visit foo.php.


    Since this is Friday, I'm not sure I follow that. Okay, if the form is
    submitted with a 'name', it redirects to foo.php/name. What is $_SERVER
    ['PATH_INFO'] for, and how does this create a user-named document?

    --
    Neredbojias
    Infinity can have limits.
    Neredbojias, Apr 7, 2006
    #6
  7. wes

    Toby Inkster Guest

    Neredbojias wrote:

    > Since this is Friday, I'm not sure I follow that. Okay, if the form is
    > submitted with a 'name', it redirects to foo.php/name. What is $_SERVER
    > ['PATH_INFO'] for, and how does this create a user-named document?


    Run it and see.

    --
    Toby A Inkster BSc (Hons) ARCS
    Contact Me ~ http://tobyinkster.co.uk/contact
    Toby Inkster, Apr 8, 2006
    #7
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.

Share This Page