Tips and Tricks HQ Support Portal › Forums › Simple PayPal Shopping Cart › Simple Shopping Cart Tweaks › Simple Shopping Cart – Capture Extra Information › Reply To: Simple Shopping Cart – Capture Extra Information
Hi Ruhul,
Into your wp_shopping_cart.php file which displays the checkout page, within a form, I added two input boxes, as below:
<form action="http://www.travelhorizonstyle.com.au/wp-content/cust-write.php" method="post" name="book"><input type="text" size="10" value="" name="First"><br><input type="text" size="10" value="" name="Last"><input type="submit" value="NEXT"></form>';
Into the cust-write.php file I have tried various methods to get these two fields to be written to the database, without success as I keep getting an error about and invalid object… The variations are commented out below:
<?php
function save() {
global $wpdb;
$key1 = "user_login";
$key1 = "user_nicename";
$First = $_POST['First'];
$Last = $_POST['Last'];
$result = $wpdb->query( $wpdb->prepare( "INSERT INTO {$wpdb->customers} ( user_login, user_nicename ) VALUES ( %s, %s )", $First, $Last ) );
//$wpdb->insert( 'table', array( 'column1' => 'value1', 'column2' => 123 ), array( '%s', '%d' ) )
//$wpdb->insert( $wpdb->customers, array( user_login => $First, user_nicename => $Last ) );
//$wpdb->query( $wpdb->prepare( " INSERT INTO $wpdb->customers ( $key1, $key2 ) VALUES ( %s, %s )", $First, $Last ));
//$wpdb->query( $wpdb->prepare( " INSERT INTO $wpdb->customers ( user_login, user_nicename ) VALUES test, tester ));
//$wpdb->query("INSERT INTO $wpdb->customers VALUES(" .$First .",". $Last . ")");
$wpdb->flush();
//Parse error: syntax error, unexpected T_OBJECT_OPERATOR i
//Call to a member function insert() on a non-object in..line 7
//Call to a member function query() on a non-object in.. line 8
//return $result;
}
?>
Can you give me suggestions as to why it will not write the the database table ‘customers’ ??
Kind regards,
Joan.