Similar to how you create a post in wordpress or even ask a question on this very website.
I want to know how to create a page by just filling out a form?
Here's what I know:
-I know how to make an html form
-I know how to place data in a database and take it out
-I know some php
What I don't know is how to to tie all of these things together. Please be as specific as possible and if you know of a tutorial on how to do this or you have the time to make a small example I would be very very grateful.
Thank you in advance for your time :-)
EDIT: To provide more details
I want to send data from a form (even a few text inputs would be enough) and for them to be placed in a page where I can display them.
And also that page should have an unique identifier so it gets stored similar to the questions on stack overflow where there is www.stackoverflow.com/posts/'identifiernumber' And I would always to go back to that information provided I access the link which I assumed will be stored in the database.
Wordpress
uses wysiwyg
this is used to convert normal text into html code you can find jquery plugins for it.After user has entered the content of the page and hits submit. Wordpress directly stores the content in the database in HTML FORMAT
. Now all it does is echo
out the content stored in the database.
Now for the identifier , it should point out to the primary key of the database row where the content is stored. Wordpress
stores a unique url as the identifier like the questions you asked is How to create a page using a form? php/html it will store it as how-to-create-a-page-using-a-form-php-html . This is then put in the href
attribute of <a>
tag , on click of this unique identifier it echo
out the content of that row.
All you have to do now is make a form and textarea , apply the wysiwyg
plugin on the textarea . Then onsubmit store the data in the database and also creating a unique identifier for it.
You question now is how to pass the identifier in the URL
?
First you must know how to pass a variable in the URL
and then capture it in the required place eg : www.yourwebsite.com?identifier=something
and to make this a link on you website
<a href="www.yourwebsite.com?identifier=something">Something</a>
Once you have mastered this you can then study a concept called MOD REWRITE
and in layman term for this is called clean URL or SEO URL . There are many blogs and methods of achieving this goal. You can google MOD REWRITE
and SEO URL
.
Create your website theme
on first page create form like you want
concept is like registration form and second page is edit profile
now what you stored in database from registration form
now echo in your edit profile form for example username in database can be viewed in edit profile form
select * FROM registrationtable WHERE userid='$userid'
then store values in variables like for example
while ($query = mysql_fetch_array($request))
{
$username = $query['username'];
}
<input type="text" name="username" value="<?php echo $username; ?>"/>
p.s dont use mysql better options are mysqli and PDO