Create a new page on hitting submit.

Discussion in 'PHP' started by iKed, Feb 18, 2011.

  1. #1
    Hi all,
    What I am trying to do is
    On "Page 1", user fills a form, and when he clicks on "Submit",
    a new page, say "Page 2" should get automatically created (in the same folder as index.php) in such a way that name of the page is say first_name.php (what the user filled on page 1) and it should display the contents of what he filled in on the first page.
    Something like showed in the figure.
    http://i54.tinypic.com/j768wj.jpg
    Please help guys!
    Thanks and Regards.
     
    iKed, Feb 18, 2011 IP
  2. Scoty

    Scoty Active Member

    Messages:
    620
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    60
    #2
    Why not just submit to page2.php (for example) then use $_POST['name'] to display the name? As for actually creating a new page (which is obviously what you are asking) I wouldn't know how to do this off the top of my head, but would send the data back to index.php and create it from there
     
    Scoty, Feb 18, 2011 IP
  3. SerpentsVemon

    SerpentsVemon Peon

    Messages:
    10
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I've attached a simple example that I created real quick, Take a look at it, it should be pretty self explanatory. If you have any questions let me know.
     

    Attached Files:

    SerpentsVemon, Feb 19, 2011 IP
  4. srisen2

    srisen2 Peon

    Messages:
    359
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #4
    you would have to use a php file to shell_exec and process a touch command to create a file then write to that file
     
    srisen2, Feb 22, 2011 IP
  5. spaceman12

    spaceman12 Active Member

    Messages:
    60
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    63
    #5
    why would you want to do it that way which appears alot complicated in nature when there are many other advanced alternatives available? unless i know so sure of what your inetentions are, i cant help you provide a real time solution. Otherwise, what the fellow above suggested you would be an ideal solution.
     
    spaceman12, Feb 23, 2011 IP
  6. cane

    cane Active Member

    Messages:
    51
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    56
    #6
    i agree with what was said in above posts,

    i dont think creating a new page would be the best thing to do. you could post your content from the index.php page and then on another php file (i.e name.php) you will have the content echo'd
     
    cane, Feb 23, 2011 IP