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
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.

Link to comment
Share on other sites

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>";


Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.