Hello,
I am not a perfect programmer but please help me. I want to post a form to my custom database in wordpress. I have tryed a lot of things and normal it is working but in wordpress it don't. For programming in php I have to add [insert_php] from a plugin otherwise php don't work in wordpress.
Please help me.
Hans
[insert_php]
/* Config Values - You need to know these */
$db_host = 'MYCODE';
$db_user = 'MYCODE';
$db_pass = 'MYCODE';
$db_name = 'MYCODE';
/* Connect to the new database */
$externalQuery = new wpdb($db_user, $db_pass, $db_name, $db_host);
If($_POST['verzenden']) {
$sStraat=$_POST['Straat'];
if($externalQuery->insert('rittenAdressen', array 'straat' => $sStraat ) == false) wp_die('Database Insertion failed'); else echo 'Database insertion successful<p />';
}
else
{
[/insert_php]
<form action="" method="post">
Streetname: <input type="text" name="Straat">
<input type="submit" name="verzenden" value="verzenden">
</form>
[insert_php]
} // end else no post['submit']
[/insert_php]
[Please post code & markup between backticks or use the code button. Your posted code may now have been permanently damaged by the forum's parser.]