Current location: Hot Scripts Forums » Programming Languages » PHP » How do I create a form that, when submitted, a new page takes on its URL?


How do I create a form that, when submitted, a new page takes on its URL?

Reply
  #1 (permalink)  
Old 09-11-05, 04:36 AM
NormanTang NormanTang is offline
Newbie Coder
 
Join Date: Sep 2005
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
How do I create a form that, when submitted, a new page takes on its URL?

How do I create a form that, when it is submitted, a new page takes on the URL of the page with the form on it, effectively replacing that page with the new page? There are a series of forms after that with slightly different URLs which will be in turn replaced as new pages are written.
Reply With Quote
  #2 (permalink)  
Old 09-11-05, 03:50 PM
dennispopel dennispopel is offline
Coding Addict
 
Join Date: Mar 2005
Posts: 263
Thanks: 0
Thanked 0 Times in 0 Posts
Hello,

Please be more specific. It is very hard to understand what you mean.
__________________
onPHP5.com - PHP5: Articles, News, Tutorials, Interviews, Software and more
Reply With Quote
  #3 (permalink)  
Old 09-12-05, 08:18 AM
NormanTang NormanTang is offline
Newbie Coder
 
Join Date: Sep 2005
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Being more specific

Hello,

To be more specific I want to create a form, when submitted, it becomes a web page. The web page that is created replaces the URL of the form.
Reply With Quote
  #4 (permalink)  
Old 09-12-05, 08:24 AM
NormanTang NormanTang is offline
Newbie Coder
 
Join Date: Sep 2005
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Example

Heres an example of what I'm looking for:

http://www.valeriemates.com/cgi-bin/...412&chapter=10

When you click on "Touch one of the Translucent areas", you will be taken to a form that, when you fill in and submit, will become a web page that replaces the URL of the form.
Reply With Quote
  #5 (permalink)  
Old 09-14-05, 03:54 PM
digioz's Avatar
digioz digioz is offline
Community VIP
 
Join Date: Oct 2003
Location: Chicago, IL
Posts: 2,171
Thanks: 3
Thanked 9 Times in 9 Posts
Here is what I THINK you are looking for:


PHP Code:

<?
if (isset($_POST['Submit']))
{
     echo 
'Your Web Page Content Goes Here!';
}
else
{
    
?>
        <form method="POST" action="<? echo $_SERVER['PHP_SELF']; ?>">
        <!-- Your Form Goes Here -->
        <input type="textbox" name="fieldname">
        <input type="Submit" name="Submit" value="Submit Form">
        </form>
    <?
}
?>
__________________
Reply With Quote
  #6 (permalink)  
Old 09-15-05, 09:47 AM
NormanTang NormanTang is offline
Newbie Coder
 
Join Date: Sep 2005
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Thank you digioz

Thank you digioz for the help. That code you suggested looks like it will do the job.
Reply With Quote
  #7 (permalink)  
Old 09-15-05, 09:53 AM
Keith's Avatar
Keith Keith is offline
Community Liaison
 
Join Date: Feb 2004
Posts: 1,232
Thanks: 1
Thanked 11 Times in 11 Posts
Quote:
Originally Posted by NormanTang
Hello,

To be more specific I want to create a form, when submitted, it becomes a web page. The web page that is created replaces the URL of the form.
That is actually less specific than your original question. Does the process involve a magic wand or secret handshake?

And type="textbox" is not a valid input attribute. Digioz might be thinking:
Code:
<textarea name="fieldname"></textarea>

Last edited by Keith; 09-15-05 at 09:58 AM.
Reply With Quote
  #8 (permalink)  
Old 09-15-05, 10:05 AM
digioz's Avatar
digioz digioz is offline
Community VIP
 
Join Date: Oct 2003
Location: Chicago, IL
Posts: 2,171
Thanks: 3
Thanked 9 Times in 9 Posts
Hehehe.... you are absolutely right Keith. instead of textarea it should read:


Code:
<input type="text" name="fieldname">
That's what happens when you type a code out in a hurry.
__________________
Reply With Quote
  #9 (permalink)  
Old 09-15-05, 10:10 AM
Keith's Avatar
Keith Keith is offline
Community Liaison
 
Join Date: Feb 2004
Posts: 1,232
Thanks: 1
Thanked 11 Times in 11 Posts
Haha... no worries, we've all done it.
Reply With Quote
  #10 (permalink)  
Old 09-16-05, 11:08 AM
NormanTang NormanTang is offline
Newbie Coder
 
Join Date: Sep 2005
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Further question

Thank you Keith for the correction.

I have another question. How do I make it so that the web page, which is created when I submit the form, contains some formatted text and two links which lead to forms?

For example, if I had a form with a text box, where you would type the title of the chapter, when submited, the text in the text box would be formatted to a larger size and bold on the resulting web page.

The two links would lead to different threads of the story, or forms if the chapters haven't been written yet.
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I create a form that, when submitted, a new page takes on its URL? NormanTang HTML/XHTML/XML 2 09-09-05 10:53 AM
How do I create a form that, when submitted, a new page takes on its URL? NormanTang New Members & Introductions 2 09-08-05 10:34 AM
Classified Ads skipper23 Perl 2 12-30-03 03:43 AM
Declared Functions skipper23 PHP 4 12-17-03 10:06 AM
index page not showing up skipper23 PHP 3 12-15-03 01:10 PM


All times are GMT -5. The time now is 06:12 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.