Temos pavadinimas: WordPress, Shopify ir PHPFusion programuotojų bendruomenė :: Pagalbos

Parašė KiraLT· 2011 Rugp. 10 18:08:22
#1

Aš noriu sukurti toki user field lauką, kad galima butu ne tiesiog įrašyti, bet pasirinkti iš esamu variantų (panašiai kaip pasirenki gimimo datą, kalbą ir pan.

Čia yra mano kodai, bet man niekaip neišeina padaryti kad leistų pasirinkti:

Čia user_club_include.php
<?php
if (!defined("IN_FUSION")) { die("Access Denied"); }

if ($profile_method == "input") {
   echo "<tr>\n";
   echo "<td class='tbl'>".$locale['uf_club'].":</td>\n";
   echo "<td class='tbl'><input type='text' name='user_club' value='".(isset($user_data['user_club']) ? $user_data['user_club'] : "")."' maxlength='16' class='textbox' style='width:200px;' /></td>\n";
   echo "</tr>\n";
} elseif ($profile_method == "display") {
   if ($user_data['user_club']) {
      echo "<tr>\n";
      echo "<td width='1%' class='tbl1' style='white-space:nowrap'>".$locale['uf_club']."</td>\n";
      echo "<td align='right' class='tbl1'>".$user_data['user_club']."</td>\n";
      echo "</tr>\n";
   }
} elseif ($profile_method == "validate_insert") {
   $db_fields .= ", user_club";
   $db_values .= ", '".(isset($_POST['user_club']) ? stripinput(trim($_POST['user_club'])) : "")."'";
} elseif ($profile_method == "validate_update") {
   $db_values .= ", user_club='".(isset($_POST['user_club']) ? stripinput(trim($_POST['user_club'])) : "")."'";
}
?>





o čia user_club_include_var.php
<?php
if (!defined("IN_FUSION")) { die("Access Denied"); }

$user_field_name = $locale['uf_club'];
$user_field_desc = $locale['uf_club_desc'];
$user_field_dbname = "user_club";
$user_field_group = 1;
$user_field_dbinfo = "VARCHAR(16) NOT NULL DEFAULT ''";
?>



Parašė weberiz· 2011 Rugp. 10 22:08:51
#2

tai tu parašyk iš ko rinktis nori :)

Parašė weberiz· 2011 Rugp. 10 22:08:45
#3

nu vnz kaška prigaminau for fun veiks neveiks nzn :)

<?php
if (!defined("IN_FUSION")) { die("Access Denied"); }
$pasirinkimas=array(1 => 
"Mega club",
"Havana",
"staroad",
"Kita"); // pasirinkimai
$kiek = count($pasirinkimas);
if ($profile_method == "input") {
	echo "<tr>\n";
	echo "<td class='tbl'>".$locale['uf_club'].":</td>\n";
	echo "<td class='tbl'><select name='miestas' class='textbox' style='width:250px;'>";
	$i = 1;
	while ($i != $kiek) {
		if ($user_data['user_club'] == $i) { $sel="selected"; } else { $sel=""; }
		echo "<option value='".$i."' ".$sel.">".$pasirinkimas[$i]."</option>";
		$i++;
	}
	echo "</select></td>\n";
} elseif ($profile_method == "display") {
	if ($user_data['user_club']) {
		echo "<tr>\n";
		echo "<td width='1%' class='tbl1' style='white-space:nowrap'>".$locale['uf_club']."</td>\n";
		echo "<td align='right' class='tbl1'>".$pasirinkimas[$user_data['user_club']]."</td>\n";
		echo "</tr>\n";
	}
} elseif ($profile_method == "validate_insert") {
	$db_fields .= ", user_club";
	$db_values .= ", '".((isset($_POST['user_club'])&&isnum($_POST['user_club'])) ? $_POST['user_club'] : "0")."'";
} elseif ($profile_method == "validate_update") {
	$db_values .= ", user_club='".((isset($_POST['user_club'])&&isnum($_POST['user_club'])) ? $_POST['user_club'] : "0")."'";
}
?>
<?php
if (!defined("IN_FUSION")) { die("Access Denied"); }
 
$user_field_name = $locale['uf_club'];
$user_field_desc = $locale['uf_club_desc'];
$user_field_dbname = "user_club";
$user_field_group = 1;
$user_field_dbinfo = "INT(3) NOT NULL DEFAULT '0'";
?>

Redagavo weberiz· 2011 Rugp. 10 22:08:16

Parašė KiraLT· 2011 Rugp. 11 20:08:42
#4

Neveikia kazko, sugadina visa psl...