inserting form data to custom database table
-
hi,
the pain is getting harder and i really need your helps!!!!Before i’m telling my problems i need to clarified you all not to comment on using ContactForm 7 to DB.
my problem is that, i have created a database table using custom plugin and it works quite well. what my problem is that from the back-end i could easily insert, delete or updates data and i could also easily retrieve data into my front-end, but what i really would like to do is to let the third party users, or guest of my website to enter the data from FORM and i want to insert those data into my database table.
i did all the php coding and i used $_POST[‘some_form_input’] to input data from the form.
But when i check my database from the backend , all i could see is the auto-incremented ID field and blank data.so what could be my problem.
for your reference here is my coding<?php
//Variables for connecting to your database.
//These variable values come from your hosting account.
$hostname = “localhost”;
$username = “root”;
$dbname = “wordpress”;//These variable values need to be changed by you before deploying
$password = “”;
$usertable = “wp_achord”;//Connecting to your database
mysql_connect($hostname, $username, $password) OR DIE (“Unable to
connect to database! Please try again later.”);
mysql_select_db($dbname);
if(isset($_POST[‘submit’])){$query = “INSERT INTO wp_achord
(name, chord) VALUES (‘”.$_POST[‘name’].”‘, ‘”.$_POST[‘chord’].”‘)”;mysql_query($query);
}else{
?>
<div id=”content” role=”main”><form method=”post”>
<div>Name:<span class=”errortext”>*</span></div>
<div><input id=”name” name=”name” type=”text” /></div><div>chord:<span class=”errortext”>*</span></div>
<div><input id=”chord” name=”chord” type=”text” /></div>
<div><input id=”submit-button” value=”submit” name=”submit” type=”submit” /></div>
</form>
<?php }?></div>
-
That is not a free hosted WordPress.com blog. We cannot help with that site as you are posting to the wrong support forum. We don not provide support for local installs of WordPress.ORG software at WordPress.com.
WordPress.com and WordPress.org are completely separate and have separate logins. If you don’t have a username account at WordPress.ORG click this link http://wordpress.org/support/ and register one on the top right hand corner of the page that opens, so you can post to the support forums there and receive advice from WordPress.ORG bloggers.
- The topic ‘inserting form data to custom database table’ is closed to new replies.