creating html page

W

wes

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
 
N

Neredbojias

To further the education of mankind said:
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.
 
A

Arjen

wes said:
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
 
T

Toby Inkster

Neredbojias said:
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.
 
N

Neredbojias

To further the education of mankind, Toby Inkster
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?
 
T

Toby Inkster

Neredbojias said:
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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top