Your Ad Here

Thursday, April 2, 2009

Help a newbie pls!

Hello all from Greece (Sorry for my English)!
If anybody can help me with this problem please make a post!
I am having trouble with my php script when i am trying to redirect the users of my contact form to the thank you page and this think drives me crazy.
I know that the is not working because i output somethink on the browser before the header command.
Is there any other way to do this with php? No meta redirection.

Here are the 3 php scripts that are needed for the form to work!

1)Prosses.php :

PHP:
---------



if(isset($_POST['submit'])){
$problem = FALSE;
if(empty($_POST['name'])){
$problem = TRUE;
echo "Παρακαλώ εισάγετε το όνομά σας!\n";
}
if(empty($_POST['email'])){
$problem = TRUE;
echo "Παρακαλώ εισάγετε το email σας!\n";
}
if(empty($_POST['message'])){
$problem = TRUE;
echo "Παρακαλώ εισάγετε το μήνυμά σας!\n";
}

if(!$problem){
$n = $_POST['name'];
$l = $_POST['last'];
$e = $_POST['email'];
$m = $_POST['message'];
$s = "Name: $n \n";
$s .= "Last name: $l \n";
$s .= "E-mail: $e \n";


if(mail("admin@megaweb.gr", "Your Contact Form", $m . $s)){
echo " Το μύνημά σας έχει σταλεί.\n\n";
echo ' Επιστρέψτε στο http://www.megaweb.gr ';
#"Your email was successfully sent!\n";
}
else
{
echo "There was an error sending the message, please try again!\n";
}
}
}
else
{
echo "Oops, looks like you didn't submit the form, go back and fill it in!\n";
}

?>
---------


2) form.php



PHP:
---------
session_start();
if(isset($_POST['submit'])) {
if(isset($_POST['captcha_code']) && isset($_SESSION['captcha_code'])) {
if(md5($_POST['captcha_code']) == $_SESSION['captcha_code']) {
echo ' ';
}else{
die('Ο κωδικός ασφαλείας ήταν λάθος. Γυρίστε πίσω και ξαναπροσπαθήστε.') . '
';
}
}else{
if(!isset($_POST['captcha_code'])) {
echo 'Δεν έχετε εισάγει κωδικό ασφαλείας.
';
}
if(!isset($_SESSION['captcha_code'])) {
echo 'Result: No CAPTCHA was viewed.
';
}
}
}
?>
---------


Read More...
Your Ad Here

No comments: