need help on php form

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
redrox
Forum Newbie
Posts: 2
Joined: Mon Jan 17, 2011 3:15 am

need help on php form

Post by redrox »

hi to all members,
i'm new here and new to php as well and i need help with the following code. problem is: it works great in english but not with greek characters. if anyone knows what to include in the following code please help a bit. thank you guys hope to hear soon.

Code: Select all

<?php
$contact_name = $_POST['name'];
$contact_email = $_POST['email'];
$contact_subject = $_POST['subject'];
$contact_message = $_POST['message'];

if( $contact_name == true )
{
	$sender = $contact_email;
	$receiver = "your@email.com";
	$client_ip = $_SERVER['REMOTE_ADDR'];
	$email_body = "Name: $contact_name \nEmail: $sender \nSubject: $contact_subject \nMessage: $contact_message \nIP: $client_ip \";		
	$extra = "From: $sender\r\n" . "Reply-To: $sender \r\n" . "X-Mailer: PHP/" . phpversion();

	if( mail( $receiver, "Flash Contact Form - $subject", $email_body, $extra ) ) 
	{
		echo "success=yes";
	}
	else
	{
		echo "success=no";
	}
}
?>
Last edited by Benjamin on Tue Jan 18, 2011 12:27 am, edited 1 time in total.
Reason: Added [syntax=php] tags.
User avatar
social_experiment
DevNet Master
Posts: 2793
Joined: Sun Feb 15, 2009 11:08 am
Location: .za

Re: need help on php form

Post by social_experiment »

“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
redrox
Forum Newbie
Posts: 2
Joined: Mon Jan 17, 2011 3:15 am

Re: need help on php form

Post by redrox »

still i do not have a clue on how to implement it into the above code
User avatar
social_experiment
DevNet Master
Posts: 2793
Joined: Sun Feb 15, 2009 11:08 am
Location: .za

Re: need help on php form

Post by social_experiment »

redrox wrote:still i do not have a clue on how to implement it into the above code
You have to added a charset attribute with a property to your header, in your case the $extra variable.
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
Post Reply