Jump to content

Recommended Posts

Hello i try to pass greek words(f.ex Γιάννης ) from a input text of a form (in a html) via Javascript (document.form.sumbit())

i have as attitude of form acceptCharset="UTF-8";

if i type myself the greek words in variable at .php (not in html form) mysql update corrected

if i type myself the greek words in .php?value1=...&value2=... and use $_GET['value1']  Mysql udate correct

 

1)when i try to pass with post there is the problem it appear me Ξ$*#Ξ%#Ξ$Ξ#Ξ$Ξ%Ξ  while the word is "ογαμιαςογιαννης"

(i put  to echo the $sQuery that send to server and its wrong)

 

2) if i put in the .php  header(...UTF-8); While the sQuery printed on Browser CORRECTED  , with my putty i see that Mysql Database updated INCORRECTED

 

Anyone knows how i can send correct the UTF-8 values to the Mysql database?

 

code of 1) and 2)

	    
   //header('Content-type: text/html; charset=utf-8');     (these exist only in code of 2)    )
    $sInfo = ""; 
    
  
    $sDBServer = "localhost"; 
    $sDBName = "SSSSSS"; 
    $sDBUsername = "SSSSSS"; 
    $sDBPassword = "SSSSSS"; 

    //create the SQL query string 
    $sQuery = "Insert into account Values('$_POST[account]' ,'$_POST[password]','$_POST[email]','$_POST[location]','$_POST[name]','$_POST[lname]','$_POST[address]','$_POST[phone]',0)";

              
   
    $oLink = mysql_connect($sDBServer,$sDBUsername,$sDBPassword); 
    @mysql_select_db($sDBName) or $sInfo = "Unable to open database"; 

    if($sInfo == '') { 
        if($oResult = mysql_query($sQuery) )
  { 
	$sInfo= "correct.html";
        }
  else{
	$sInfo="wrong.html";
  }
    }
$sQuery2= "Select * from account";
    //make the database connection 
    $oLink = mysql_connect($sDBServer,$sDBUsername,$sDBPassword); 
    @mysql_select_db($sDBName) or $sInfo = "Unable to open database"; 
        
    if($sInfo == '') { 
        if($oResult = mysql_query($sQuery) and mysql_num_rows($oResult) > 0) { 
            $aValues = mysql_fetch_array($oResult,MYSQL_ASSOC); 
            $sInfo = $aValues['name']."<br />".$aValues['address']."<br />". 
                     $aValues['e_mail']."<br />".$aValues['Password']."<br />". 
                     $aValues['location']."<br /><br />Phone: ".$aValues['account']."<br />";
		}
	}
    
    mysql_close($oLink); 
echo $sInfo;
echo $sQuery;
?> 

for 2) code

 

Explorer broswer (echoed sQuery) => Insert into account Values('δασδα' ,'α','asdad@in.gr','ασδζχψ','ασδασδ','ασδασδ','ασδς;ε','2222222222',0)

 

Mysql Database (with putty) => | Ξ±Οδ΢ΟΟ | Ξ±      | asdas@in.gr        | Ξ±Οδ΢ΟΟ        | Ξ±Οδαδ        | Ξ±ΟΞ΄              | Ξ±ΟΡ΢ΟΟ                  | 2222222222 |    0 |

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.