Since the Wordpress Post Editor is HTML, you can add radio buttons, etc. into your post. But when you have say 2 radio buttons, and a submit button at the bottom, you can input your data then click submit but nothing happens. Is there any way of returning information from a database when the submit button is clicked? If so how would this be done, can you just add new tables in the WP Database?
PS: I am running Wordpress 3.2 Selfhosted, not wordpress.com
You can create a Page Template for each page with such a form, then put the code to process the form and do whatever database work you need in that template.
Pages « WordPress Codex
Yes you can add your own tables to the WP database. WordPress doesn’t know or care what else is there as long as its own tables are present.
An elegant way would be to create some Wordpress plugin that creates extra tables as needed and provides the extra functionality with hooks.
Thanks for the input guys, but couldn’t I just put this code in a post/page:
<form action=“filename.php” method=“post”>
Name: <input type=“text” name=“fname” />
Age: <input type=“text” name=“age” />
<input type=“submit” />
And then install filename.php on the server? I tried that and it successfully worked but displayed it in a new webpage (mywebsite.com/filename.php). Since I am new to PHP I don’t know how I can get it to display in the same post as the form (without leaving that page).
Make the form action the URL of the page. You know what that URL is. Don’t write something else (filename.php).
OK but then it just reloads my homepage and nothing happens. Doesn’t it need to be linked to a file that will process the data and return something?
You pointed it at the URL of your page (/some/actual/url) and it reloaded your homepage? That’s not what happens for me.
Yes, I put my URL in the following part of the code:
<form action=“this is where I put my URL” method=“post”>
Am I supposed to put it somewhere else?