Submit data into mysql database using wordpress?
-
I’m having trouble figuring out a way to insert data into my own mysql database setup within wordpress. What am I doing wrong?
http://carlots.net/blog/cars-3/
<?php global $wpdb; $name = $_POST['name']; $email = $_POST['email']; $phone = $_POST['phone']; $address = $_POST['address']; $table_name = $wpdb->prefix . 'customers'; $wpdb->insert( $table_name, array( 'name' => $name, 'email' => $email, 'phone' => $phone, 'address' => $address), array('%s','%s','%s','%d',)); ?> <form type="post" action="cars-3/" > <label for="name">Name:</label> <input name="name" type="text" /> <br/> <label for="email">Email:</label> <input name="email" type="text" /> <br/> <label for="phone">Phone:</label> <input name="phone" type="text" /> <br/> <label for="address">Address:</label> <input name="address" type="text" /> <br/> <input type="submit"> </form> <br/><br/> <div id="feedback"></div> <br/><br/>
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
The topic ‘Submit data into mysql database using wordpress?’ is closed to new replies.