ugrás a tartalomhoz

Php űrlap, nem kezeli az ékezetet, lehet ezt orvosolni?

Anonymous · 2006. Aug. 6. (V), 12.47
Sziasztok!

Találtam egy működő PHP űrlapot, aminek nagy bibije van, mégpedig az ékezeteket nem kezeli, lehet ezt orvosolni valahogy?

A forráskódja a következő:
<?php
$nasaadresa = "sample##kukac##mail.com";  //please replace this with your address

$mail = $_POST['Email'];
$porukaa = $_POST['Message'];
$poruka = str_replace("\r", '<br />', $porukaa);
//START OF THANKS MESSAGE
//you may edit $thanks message. this is a message which displays when user sends mail from your site
$thanks = "
<p align='left'><br>
<b>Your message has sucessfuly been sent!<br></b>
#### MESSAGE TEXT #### 
<br><br>
$poruka
<br><br>
#### END OF MESSAGE ####
<br><br>
You will recive a copy of the message at your email address <b>($mail).<br>We will reply you soon as possible<br></b></p>";
//do not edit nothing below this line  until comment (ME) say so if you don't have skills with PHP
//END OF THANKS MESSAGE

if($_POST['submitform']) 
{

	$Name = $_POST['Name'];
	$Email = $_POST['Email'];
	$Message = $_POST['Message'];
	$require = $_POST['require'];
	$browser = $HTTP_USER_AGENT;
	$ip = $_SERVER['REMOTE_ADDR'];

	$dcheck = explode(",",$require);
	while(list($check) = each($dcheck)) 
	{
		if(!$$dcheck[$check]) {
		$error .= "You have not filled this filed(s): <b>$dcheck[$check]</b>.<br>";
		}
	}
	if ((!ereg(".+\@.+\..+", $Email)) || (!ereg("^[a-zA-Z0-9_@.-]+$", $Email))){
	$error .= "Wrong e-mail.<br>This e-mail address <b>$Email</b> - is not valid. Please enter correct e-mail address.";
	}
	if($error)
	{
	echo $error;
	echo '<br><a href="#" onClick="history.go(-1)">Please try again.</a>';
	}
	else
	{
//START OF INCOMING MESSAGE (this message goes to your inbox)
$message = "
Name: $Name:
E-mail: $Email

Message: $Message

-----------------------------
Browser: $browser
IP: $ip
";
//END OF INCOMING MESSAGE (this message goes to your inbox)

$subject = "Message from your site.com - Message was sent by $Name"; //subject OF YOUR INBOX MESSAGE sent to you

$subject2 = "You have succesfully sent message from yoursite.com!"; //subject of OUTGOING MESSAGE - edit this
//OUTGOING MESSAGE TEXT
$message2 = "You have sent a message to site admin of a yourdomain.com:
-----------------------------
From: $Name:
E-mail: $Email
	
Message: $Message

-----------------------------
";
//END OF outgoing MESSAGE


mail($nasaadresa,"$subject","$message","From: $Name <$Email>");
mail($Email,"$subject2","$message2","From: <$nasaadresa>");
echo "$thanks";
	}
}
else{
//this is contact form down here, please edit if you know what are you doing... or the contact form may not be working.
echo '
<p align="center"><br><b>Please contact us:</b></p><br><br>
<form name="contactform" action="'.$PHP_SELF.'" method="post">
<input type="hidden" name="require" value="Name,Email,Message">
  <table width="444" align="center">
    <tr>
      <td colspan="2" align="center">
        <p></td>
    </tr>
    <tr>
      <td valign="top" align="right"><b>Name:</b></td>
      <td valign="top">
        <input name="Name" size="30">
      </td>
    </tr>
    <tr>
      <td valign="top" align="right"><b>E-mail:</b></td>
      <td valign="top">
        <input name="Email" size="30">
      </td>
    </tr>
    <tr>
      <td valign="top" align="right"><b>Message:</b></td>
      <td valign="top">
        <textarea name="Message" rows="10" cols="30"></textarea>
      </td>
    </tr>
    <tr>
      <td colspan="2" align="center"><p align="right"><br>
        <input type="submit" value="Send" name="submitform">
        <input type="reset" value="Reset" name="reset"></p>
      </td>
    </tr>
  </table>
</form>';
}
?>
 
1

charset beállítás

Hodicska Gergely · 2006. Aug. 6. (V), 13.48
Ebben a cikkben nagyon jól le van írva minden, amire jelen esetben szükséged lehet, kezdők számára is teljesen jól olvasható.


Felhő

u.i.: forráskódok beillesztésekor érdemes használnod a colorer bbcode-ot, CTRL-P lenyomásával könnyedén elérhető.