Jump to content

Creating A Page Using A Form


josephman1988

Recommended Posts

I know how to create a form, I know how to collect the inputted data and insert it into the MySQL DB, I also know how to publish the data as soon as the form is submitted - but only on existing pages.

I want it so once the form is submitted, a templated page will be created with the data. Each time I input more dta in the form, another page is created.

 

I don't expect any of you to help me out by supplying me code, I won't learn that way.

I would like to know the topics which I should learn to know how to do this .. of course, code will be great.

 

Thanks in advanced.

Link to comment
https://forums.phpfreaks.com/topic/101972-creating-a-page-using-a-form/
Share on other sites

U could use php's file handling functions (fopen(), fread(), fwrite()) to generate pages on fly, but i dont think this is a great method. Having url's like index.php?id=xx has the same results. U have index.php a template and the id or any other parameters define what information the template will contain. In this way u have everything in control and dont end up with tens or thousands of pages, u just have one (index.php). Anyway u could explain better what u want to achieve.

I use this structure all the time

 

<head>
</head>

<body>
<div id="main">
<div id="site_content">
<?

include 'header.php'; 
include 'navigation.php'; 
include "pages/$page.php";  // DIFFERENT PAGES
include 'footer.php'; 

?> 
</div>
'</div>
</body>
</html>

// HERE IS THE NAVIGATION PAGE
echo"
<ul id='menu'>
        <li><a href='?page=home'>Home</a></li>
        <li><a href='?page=schedule'>Schedule</a></li>
        <li><a href='?page=pricing'>Pricing</a></li>
        <li><a href='?page=about'>About Us</a></li>
        <li><a href='?page=gallery&loc=gallery'>Gallery</a></li>
        <li><a href='?page=contact'>Contact Us</a></li>
</ul>";


Anyway u could explain better what u want to achieve.

 

Ok, I have the index.php page.

I have .. let's say, admin.php which contains a form which will collect information (title, news, image) and insert it into a MySQL DB. At the press of the submit button, a page is created. A News Template Page where the image, title and news changes everytime a new news item is added. (So 5 Pages will have 5 different items).

Of course, on the index.php page a link will be created linking to the new news item.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.