Re: Can you use PHP to create a new html page?
OK, step 1: Let's clarify what PHP does.
PHP is a programming language that specializes in producing web pages... but you can produce anything, from VCards (to use a previous example from today) to .XLS files to PDF files to HTML files. In simple terms, this means that you can pass the program variables, and it executes program logic to output a display format.
PHP doesn't create an HTML file (although it -can- save a file), it simply displays HTML to the user. You don't have to have PHP save an HTML file for the file to be visible to an end-user, it only has to output HTML.
In your case, you want a user to enter data into some displayed HTML in their browser, then you want that form to submit to a particular page and do something like create a new row in a database, and then you want to redirect the user to another page that displays and allows them to change their profile information. Nowhere in there do we actually need to create an HTML file, we just need to *display* html.
Step 2: The short URLS
Google 'mod_rewrite' -- there's an apache module that will allow you to rewrite
sitename.com/foobar
into
sitename.com/user_profile.php?id=foobar
So the user enters sitename.com/foobar and then your web server sees it as user_profile.php?id=foobar ... this is how Wordpress and other blogging software creates the short access names.
Life gets much easier if you're not writing and trying to maintain the state of dynamic content with static files. Static files suck.
__________________
Karl Katzke - Available for RHEL/CentOS admin, and small PHP/HTML/XHTML jobs.
|