[PHP-users 27151] PHP+PEAR HTML QuickForm上 日本語の文字化けが起きています

sundara@cba.att.ne.jp sundara @ cba.att.ne.jp
2005年 10月 7日 (金) 09:11:09 JST


$B%9%s%@%i(B($B30?M$G$9(B)$B$H?=$7$^$9!#(B
$B$3$3$K=q$/$N$O=i$a$F$G$9!#$=$l$+$i$3$N$h$&$J(B PHP $B$b=i$a$F$G$9!#(B

$B8=:_!"(BPEAR HTML Quickform $B$r;HMQ$7$F!!8!:w2hLL$r:n @ .Cf$G$9$,!"(B
$B!V8!:w!W(BButton $B$r2!$7$F!!%G!<%?%Y!<%9$N@\B3$9$kA0$N!!(BFormData 
$B$rI=<($7$?$i!V1Q8l$N%G!<%?$, @ 5$7$/I=<($5$l$^$9$,!"(B
$BF|K\8l$NJ8;z$rF~$l$?$iJ8;z2=$1$,5/$3$j$^$9(B($BE\$k(B!)$B!#E:IU$7$F$$$k!!(B
PG $BFb$N!!(BFilter $BJ8$r30$;$PLdBj$s$P$/F|K\8l$,I=<($5$l$^$9$,!"(B
Filter $BJ8$r30$5$J$$$GF|K\8l$NI=<($,=PMh$kJ}K!$,M-$j$^$7$?$i65$($FD:$-$?$$$G$9!#(B
<$B$3$N(B $B%a!<%j%s%0%j%9%H$K$OBgJQ$*@$OC$J$C$F$$$^$9!#(B
$B0J>e$h$m$7$/8f4j$$$7$^$9!#(B

$B2<5-$N(BPG $B$O!!0J2<$N4D6-$GF0:n$7$F$$$^$9!#(B
PHP 5.04+APACHE2+Win 2003+ PEAR latest package
(Warning $B$rL5;k$7$F2<$5$$(B)

---$B$3$3$+$i!!(BPG :frmdatacheck.php---

<?php
//Program by sundara @ cba.att.ne.jp
// Program logic and ideas from internet and some books
// no copyright. but thanks to net comunity


require_once 'HTML/QuickForm.php';

//  here i am defining  a new HTML_QuickForm object
$obj_search_form = new HTML_QuickForm('frmSearch', 'POST');
$obj_search_form->registerRule('date_valid','callback','check_date_validity');
$options=array(
         'language' => 'en',
         'format' => 'dmY',
         'minYear' => '2004',
         'maxYear' => strftime("%Y",time() ) +2);
// here i am adding  form elements, one-by-one in the order
$obj_search_form->addElement('header', '', '$B8!:w(B');
$obj_search_form->addElement('html', '<tr><td colspan="2">&nbsp;</td></tr>');
$obj_search_form->addElement('text', 'txtActcode', '$B<R0w(I:0D^(B:', array('size' => 13, 'maxlength' => 13));
$obj_search_form->addElement('text', 'txtPjcode', '(IL_[<^*8D:0D^(B:', array('size' => 8, 'cols' => 8));
$obj_search_form->addElement('date', 'txtDate1', '$B3+;OF|(B:',$options);
$obj_search_form->addRule('txtDate1','$BF|IU$, @ 5$7$/$"$j$^$;$s(B','date_valid');
$tdatedefaults=array('d' => strftime('%d'),'m' => strftime('%m'),'Y' => strftime('%Y') );
$obj_search_form->setDefaults(array('txtDate1' =>$tdatedefaults));

$obj_submit[] = &HTML_QuickForm::createElement('submit', 'btnSubmit', '$B8!:w(B');
$obj_submit[] = &HTML_QuickForm::createElement('reset', 'btnReset', '$B%/%j%"(B');
$hattribute='href="home.php" ';

$obj_search_form->addGroup($obj_submit, '', '', '&nbsp;&nbsp');
$obj_search_form->addElement('html', '<p>Click <a href="frmdatacheck.php">here</a> to run again <BR><p>');

// pre-validation filters comes here
$obj_search_form->applyFilter('__ALL__', 'trim');

// here we go  for defining  rules
$obj_search_form->addRule('txtActcode', 'Please note that you can enter only  alphabets, numbers for your "Account Code', '/^[a-zA-Z0-9]{1,13}$/');

// here i am  validating the  form
if($obj_search_form->validate()) {
	
	// post-validation filters comes here
	$obj_search_form->applyFilter('__ALL__', 'addslashes');
	$obj_search_form->applyFilter('__ALL__', 'htmlentities');

	//  "search_mserver_logdata" function to store 
	$obj_search_form->process('search_mserver_logdata', false);
	
	// exit the script, on successful  
	header('Location: ./home.php');
}

function check_date_validity($date) {
  return checkdate($date['m'],$date['d'],$date['Y']);
  }

// function to store search information 
function search_mserver_logdata($ary_sloginput_info) {

$tActcode=$ary_sloginput_info['txtActcode'];
$tPjcode=$ary_sloginput_info['txtPjcode'];
//$tPjname=mb_convert_encoding($ary_sloginput_info['txtPjname'],"UTF-8","auto");$tDate1=$ary_sloginput_info['txtDate1'];

echo "accountcode <BR>\n";
echo $tActcode;
echo "<BR>prjectcode <BR>\n";
echo $tPjcode;
echo $tDate1;
echo "<BR>date2 <BR> \n";
   //  here i am searching  the information from  the database
      // data base : oracle .....
}
?>
<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS Pragma: no-cache">
 <TITLE>Serverlogcheck</TITLE>
</HEAD>
<BODY>	
<?php

	// display the form here
	$obj_search_form->display();

?>
</BODY>
</HTML>




--- $B=*N;(B----------------------------



PHP-users メーリングリストの案内