将它们存储在user\\u meta中的目的是能够打印相同的内容post->id
在另一个页面中查询同一字段。这就是我目前所拥有的。
所以我尝试了你之前所说的,但我无法成功:
/////////////////Colecionables
function coleccionables_producto() {
echo "</a>";
//foreach ($product_id as $id_prdct) {
include(\'connection-db.php\');
$db_handle = mysql_connect($server, $user_name, $password);
$db_found = mysql_select_db($database, $db_handle);
//echo "SELECT * FROM `mg_usermeta` WHERE user_id = \'" . "$user_id" . "\';";
//echo "SELECT * FROM `mg_usermeta` WHERE user_id = \'" . "$user_id" . "\';";
global $current_user, $product, $post;
$user_id = $current_user->ID;
$product_id = $post->ID;
if (isset($_POST[\'quiero\'])) {
$quieroPost = serialize(array_values($_POST[\'quiero\']));
update_user_meta( $user_id, \'lo_quiero\', $quieroPost, false );
} else if (isset($_POST[\'tengo\'])) {
$tengoPost = serialize(array_values($_POST[\'tengo\']));
update_user_meta( $user_id, \'lo_tengo\', $tengoPost, false );
} else {
//no button pressed
}
?>
<form id="wishlist-double" name="escoje" action="" method="POST" enctype="multipart/form-data">
<input id="quiero" type="radio" name="quiero" value="<?php if(isset($user_data[\'quiero\'][0])): echo $user_data[\'quiero\'][0]; endif; ?>-<?php echo esc_attr($post->ID); ?>A" href="#">Lo Quiero</button>
<input id="tengo" type="radio" name="tengo" value="<?php if(isset($user_data[\'tengo\'][0])): echo $user_data[\'tengo\'][0]; endif; ?>-<?php echo esc_attr($post->ID); ?>B" href="#">Lo Tengo</button>
<div id="formMessages"></div>
</form>
<?
//}
}