Danske tegn i variabler
Hej,Jeg er helt grøn i php.
Men problemet er når en af variablerne indeholder æ,ø eller å
Fx $Kunder_Adresse = "Skovvænget" så er den tom når den skal skrives sidst i koden her: <input type="hidden" value="<?php echo $pacsoftData['addressLine1']; ?>" name="data[<?php echo $i; ?>][addressLine1]" />
Håber nogen kan/vil hjælpe mig....
<?php
$server = "localhost";
$brugernavn = "xxxxx";
$kode = "xxxxx";
$db = "xxxxx";
mysql_connect($server , $brugernavn , $kode) or die(mysql_error());
echo "Forbundet til mysql server<br/>";
mysql_select_db($db)or die(mysql_error());
echo "Forbundet til databasen<br/><br/>";
$data = mysql_query("SELECT * FROM ordrer WHERE Ordrenr=50966" ) or die(mysql_error());
while ($info = mysql_fetch_array($data))
{
$intkundeid = $info['Kundeid'];
$Ordrer_Total = "";
$Ordrer_Porto = ""
echo "Kundeid: " . $intkundeid . "<br/>";
echo "andenLeveringsAdr: " . $info['andenLeveringsAdr']. "<br/>";
echo "omdeling: " . $info['omdeling']. "<br/>";
echo "Ordrer_Total: " . $Ordrer_Total . "<br/>";
}
$data = mysql_query("SELECT * FROM kunder WHERE Kundeid=" . $intkundeid . "" ) or die(mysql_error());
while ($info = mysql_fetch_array($data))
{
$Kunder_MobilTlf = $info['Tlf'];
$Kunder_Navn = $info['Navn'];
$Kunder_Efternavn = $info['Efternavn'];
$Kunder_Adresse = $info['Adresse'];
$Kunder_Adresse2 = "";
$Kunder_Postnr = $info['Postnr'];
$Kunder_City = $info['City'];
$Kunder_Email = $info['Email'];
$Kunder_Landekode = $info['Landekode'];
echo "Kunder_Navn: " . $Kunder_Navn . "<br/>";
echo "Kunder_Efternavn: " . $Kunder_Efternavn . "<br/>";
echo "Kunder_Adresse: " . $Kunder_Adresse . "<br/>";
echo "Kunder_Postnr: " . $Kunder_Postnr . "<br/>";
echo "Kunder_City: " . $Kunder_City . "<br/>";
echo "Kunder_Email: " . $Kunder_Email . "<br/>";
echo "Kunder_Landekode: " . $Kunder_Landekode . "<br/>";
}
?>
<form name="SmartSendForm" action="http://www.pacsoft.smartsend.dk/version4/server_request.php" method="post" target="_blank">
<?php
$pacsoft = array(
0 => array(
"NOTSMSnr" => (string) ($Kunder_MobilTlf),
"DLVFLEXcomment" => (string) ($Ordrer_DLVFLEXcomment),
"orderNo" => (string) ($Ordrer_ordrenr),
"customerNo" => (string) ($Ordrer_Kundeid),
"nameLine1" => (string) ($Kunder_Navn.' '.$Kunder_Efternavn),
"nameLine2" => "",
"addressLine1" => (string) ($Kunder_Adresse),
"addressLine2" => (string) ($Kunder_Adresse2),
"postalCode" => (string) ($Kunder_Postnr),
"city" => (string) ($Kunder_City),
"emailAddress" => (string) ($Kunder_Email),
"countryCode" => (string) ($Kunder_Landekode),
"price" => (string) ($Ordrer_Total),
"company" => (string) ($Ordrer_Porto)
));
$pacsoftUser = array(
"smartsendID" => 000,
"key" => "xxxxxxxxxxxxx",
"version" => 4,
"bulk" => 0,
"HTMLESCAPE" => 1);
$pacsoftSending = array(
"NOTEMAIL" => 1,
"NOTSMS" => 0,
"FRAG" => 0,
"GREEN" => 0,
"DLV" => 1,
"DLVFLEX" => 0,
"EXPRSAT" => 0,
"LNKPRTN" => 0,
"RETURN" => 0);
function filterHTMLSingle(&$value) {
$value = str_replace(''', ''', htmlspecialchars($value, ENT_QUOTES, 'UTF-8'));
//$value = htmlspecialchars($value, ENT_QUOTES, 'UTF-8');
}
array_walk_recursive($pacsoft, "filterHTMLSingle");
//Encrypt the data used to create the label
$pacsoftUser['check'] = md5(serialize(array(0 => $pacsoft, 1 => $pacsoftUser['key'], 2=> $pacsoftUser['smartsendID'])));
function filterUrlencodeSingle(&$value) {
$value = urlencode($value);
}
array_walk_recursive($pacsoft, "filterUrlencodeSingle");
$i = 0;
?>
<div class="advisering">
<input type="hidden" name="pacsoftSending[NOTEMAIL]" value="0">
<input id="NOTEMAIL" type="checkbox" name="pacsoftSending[NOTEMAIL]" value="1"<?php echo ($pacsoftSending['NOTEMAIL'] == 1 ? ' checked="yes"' : '') ?> /><label for="NOTEMAIL">Mail-advisering</label><br />
<input type="hidden" name="pacsoftSending[NOTSMS]" value="0">
<input id="NOTSMS" type="checkbox" name="pacsoftSending[NOTSMS]" value="1"<?php echo ($pacsoftSending['NOTSMS'] == 1 ? ' checked="yes"' : '')?>/><label for="NOTSMS">Mobil-advisering</label><br />
</div>
<div class="omtanke">
<input type="hidden" name="pacsoftSending[FRAG]" value="0">
<input id="FRAG" type="checkbox" name="pacsoftSending[FRAG]" value="1"<?php echo ($pacsoftSending['FRAG'] == 1 ? ' checked="yes"' : '')?> /><label for="FRAG">Forsigtig</label><br />
<input type="hidden" name="pacsoftSending[GREEN]" value="0">
<input id="GREEN" type="checkbox" name="pacsoftSending[GREEN]" value="1"<?php echo ($pacsoftSending['GREEN'] == 1 ? ' checked="yes"' : '')?> /><label for="GREEN">Pakke med omtanke</label><br />
</div>
<div class="omdeling">
<input type="hidden" name="pacsoftSending[DLV]" value="0">
<input id="DLV" type="checkbox" name="pacsoftSending[DLV]" value="1"<?php echo ($pacsoftSending['DLV'] == 1 ? ' checked="yes"' : '') ?> /><label for="DLV">Omdeling</label><br />
<input type="hidden" name="pacsoftSending[DLVFLEX]" value="0">
<input id="DLVFLEX" type="checkbox" name="pacsoftSending[DLVFLEX]" value="1"<?php echo ($pacsoftSending['DLVFLEX'] == 1 ? ' checked="yes"' : '') ?> /><label for="DLVFLEX">Flexlevering</label><br />
<input type="hidden" name="pacsoftSending[EXPRSAT]" value="0">
<input id="EXPRSAT" type="checkbox" name="pacsoftSending[EXPRSAT]" value="1"<?php echo ($pacsoftSending['EXPRSAT'] == 1 ? ' checked="yes"' : '') ?> /><label for="EXPRSAT">Lørdagsomdeling</label><br />
</div>
<div class="type">
<input type="hidden" name="pacsoftSending[LNKPRTN]" value="0">
<input id="LNKPRTN" type="checkbox" name="pacsoftSending[LNKPRTN]" value="1"<?php echo ($pacsoftSending['LNKPRTN'] == 1 ? ' checked="yes"' : '') ?> /><label for="LNKPRTN">Send label til mail</label><br />
<input type="hidden" name="pacsoftSending[RETURN]" value="0">
<input id="RETURN" type="checkbox" name="pacsoftSending[RETURN]" value="1"<?php echo ($pacsoftSending['RETURN'] == 1 ? ' checked="yes"' : '') ?> /><label for="RETURN">Returlabel</label><br />
<select name="pacsoftSending[COLLI]">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
</select>
<label for="colli">Antal kolli</label>
</div>
<?php
foreach ($pacsoft as $pacsoftData) {
?>
<input id="NOTSMSnr" type="hidden" value="<?php echo $pacsoftData['NOTSMSnr']; ?>" name="data[<?php echo $i; ?>][NOTSMSnr]" />
<input id="DLVFLEXcomment" type="hidden" value="<?php echo $pacsoftData['DLVFLEXcomment']; ?>" name="data[<?php echo $i; ?>][DLVFLEXcomment]" />
<input type="hidden" value="<?php echo $pacsoftData['orderNo']; ?>" name="data[<?php echo $i; ?>][orderNo]" />
<input type="hidden" value="<?php echo $pacsoftData['customerNo']; ?>" name="data[<?php echo $i; ?>][customerNo]" />
<input type="hidden" value="<?php echo $pacsoftData['nameLine1']; ?>" name="data[<?php echo $i; ?>][nameLine1]" />
<input type="hidden" value="<?php echo $pacsoftData['nameLine2']; ?>" name="data[<?php echo $i; ?>][nameLine2]" />
<input type="hidden" value="<?php echo $pacsoftData['addressLine1']; ?>" name="data[<?php echo $i; ?>][addressLine1]" />
<input type="hidden" value="<?php echo $pacsoftData['addressLine2']; ?>" name="data[<?php echo $i; ?>][addressLine2]" />
<input type="hidden" value="<?php echo $pacsoftData['postalCode']; ?>" name="data[<?php echo $i; ?>][postalCode]" />
<input type="hidden" value="<?php echo $pacsoftData['city']; ?>" name="data[<?php echo $i; ?>][city]" />
<input type="hidden" value="<?php echo $pacsoftData['emailAddress']; ?>" name="data[<?php echo $i; ?>][emailAddress]" />
<input type="hidden" value="<?php echo $pacsoftData['countryCode']; ?>" name="data[<?php echo $i; ?>][countryCode]" />
<input type="hidden" value="<?php echo $pacsoftData['price']; ?>" name="data[<?php echo $i; ?>][price]" />
<input type="hidden" value="<?php echo $pacsoftData['company']; ?>" name="data[<?php echo $i; ?>][company]" />
<?php
$i++;
} ?>
<input type="hidden" value="<?php echo $pacsoftUser['smartsendID']; ?>" name="dataInfo[smartsendID]" />
<input type="hidden" value="<?php echo $pacsoftUser['check']; ?>" name="dataInfo[check]" />
<input type="hidden" value="<?php echo $pacsoftUser['version']; ?>" name="dataInfo[version]" />
<input type="hidden" value="<?php echo $pacsoftUser['bulk']; ?>" name="dataInfo[bulk]" />
<input type="hidden" value="<?php echo $pacsoftUser['HTMLESCAPE']; ?>" name="dataInfo[HTMLESCAPE]" />
<input class="button" type="submit" value="Generere pakkelabel" />
</form>
</div>
