I'm just starting in php and i put together a simple program that asks for user input, checks if its there and if it's all there it redirects the user to a different webpage....
NOW, this works fine with ANSI encoding, but if i want to use UTF (for my language) it wont work, since apparently UTF encoding adds "something" in front of my script (i made sure there was nothing in front of the script in notepad).
The question is..... how can i make it work???
P.S. I used Notepad ++
Here's the code:
<?php
$spr=array("ime", "priimek", "telefon");
if (count($spr)==count($_POST)){
$null=0;
foreach($_POST as $v){
if($v==""){
$null++;
}
}
if ($null==0){
header("Location: /index2.php");
}
}
?>
<html>
<head>
<title>nekaj</title>
</head>
<body>
<form action="#" method="post">
<?php
foreach($spr as $s){
if(!$_POST["$s"]){
print "$s: <input type=\"text\" name=\"$s\"><br>";
}
else{
print "<input type=\"text\" name=\"$s\" value=\"$_POST[$s]\" ><br>";
}
}
?>
<input type="submit">
</form>
</body>
</html>
NOW, this works fine with ANSI encoding, but if i want to use UTF (for my language) it wont work, since apparently UTF encoding adds "something" in front of my script (i made sure there was nothing in front of the script in notepad).
The question is..... how can i make it work???
P.S. I used Notepad ++
Here's the code:
<?php
$spr=array("ime", "priimek", "telefon");
if (count($spr)==count($_POST)){
$null=0;
foreach($_POST as $v){
if($v==""){
$null++;
}
}
if ($null==0){
header("Location: /index2.php");
}
}
?>
<html>
<head>
<title>nekaj</title>
</head>
<body>
<form action="#" method="post">
<?php
foreach($spr as $s){
if(!$_POST["$s"]){
print "$s: <input type=\"text\" name=\"$s\"><br>";
}
else{
print "<input type=\"text\" name=\"$s\" value=\"$_POST[$s]\" ><br>";
}
}
?>
<input type="submit">
</form>
</body>
</html>