nach dem senden eines kontaktformulars auf andere website leiten? checkbox einfügen

Am besten den kompletten Code posten mit
[code=php][/code]

Edit: Eigentlich solltest du den Code kennen den du gepostet hast und sehen wo mein Teil hingehört!

PHP:
<?
// edit these lines
$your_name="";
$your_email="";
$your_web_site_name="";
?>

<?php
//If the form is submitted
if(isset($_POST['name'])) {

//Check to make sure that the name field is not empty
if(trim($_POST['name']) === '') {
$hasError = true;
} else {
$name = trim($_POST['name']);
}

//Check to make sure sure that a valid email address is submitted
if(trim($_POST['email']) === '') {
$hasError = true;
} else if (!eregi("^[A-Z0-9._%-]+@[A-Z0-9._%-]+\.[A-Z]{2,4}$", trim($_POST['email']))) {
$hasError = true;
$errorMessage = "Please enter a valid email address!";
} else {
$email = trim($_POST['email']);
}

//Check to make sure that the phone field is not empty
if(trim($_POST['phone']) === '') {
$hasError = true;
} else {
$phone = trim($_POST['phone']);
}

//company name
$company_name = trim($_POST['company_name']);

//company url
$company_url = trim($_POST['company_url']);


//Check to make sure comments were entered
if(trim($_POST['message']) === '') {
$hasError = true;
} else {
if(function_exists('stripslashes')) {
$comments = stripslashes(trim($_POST['message']));
} else {
$comments = trim($_POST['message']);
}
}



//If there is no error, send the email
if(!isset($hasError)) {

$emailTo = $your_email;
$subject = 'Contact Form Submission from '.$name;

//message body
$body ="Name: $name \n\n";
$body .="Email: $email \n\n";
$body .="Phone:$phone\n\n";
$body .="Company Name:$company_name\n\n";
$body .="Company Url:$company_url \n\n";
$body .="Message: $comments";


$headers = 'From: '.$your_web_site_name.' <'.$emailTo.'>' . "\r\n" . 'Reply-To: ' . $email;

mail($emailTo, $subject, $body, $headers);

$emailSent = true;
}
}
?>

<?php if(isset($emailSent) == true)
          {
                 header ("LOCATION: hier die URL");
                 die;
          } ?>

<?php if(isset($hasError) ) { ?>
<div class="error_box">
There was an error submitting the form.
<br />
<?php echo $errorMessage;?>
</div>
<?php } ?>

So war es angedacht! Natürlich solltest du hier:

LOCATION: hier die URL

Die URL eintragen!
 
Zuletzt bearbeitet:
So sieht der Code im Moment aus

PHP:
<?
// edit these lines
$your_name="Schnell Recht";
$your_email="info@akmuc.de";
$your_web_site_name="schnellrecht";
?>

<?php 
//If the form is submitted
if(isset($_POST['name'])) {

		//Check to make sure that the name field is not empty
		if(trim($_POST['name']) === '') {
			$hasError = true;
		} else {
			$name = trim($_POST['name']);
		}
		
		//Check to make sure sure that a valid email address is submitted
		if(trim($_POST['email']) === '')  {
			$hasError = true;
		} else if (!eregi("^[A-Z0-9._%-]+@[A-Z0-9._%-]+\.[A-Z]{2,4}$", trim($_POST['email']))) {
			$hasError = true;
			$errorMessage = "Please enter a valid email address!";
		} else {
			$email = trim($_POST['email']);
		}

		//Check to make sure that the phone field is not empty
		if(trim($_POST['phone']) === '') {
			$hasError = true;
		} else {
			$phone = trim($_POST['phone']);
		}

		//company name
		$company_name = trim($_POST['company_name']);

		//company url
		$company_url = trim($_POST['company_url']);

			
		//Check to make sure comments were entered	
		if(trim($_POST['message']) === '') {
			$hasError = true;
		} else {
			if(function_exists('stripslashes')) {
				$comments = stripslashes(trim($_POST['message']));
			} else {
				$comments = trim($_POST['message']);
			}
		}




		//If there is no error, send the email
		if(!isset($hasError)) {

			$emailTo = $your_email;
			$subject = 'Contact Form Submission from '.$name;
			
			//message body 
			$body  ="Name: $name \n\n";
			$body .="Email: $email \n\n";
			$body .="Phone:$phone\n\n";
			$body .="Company Name:$company_name\n\n";
			$body .="Company Url:$company_url \n\n";
			$body .="Message: $comments";


			$headers = 'From: '.$your_web_site_name.' <'.$emailTo.'>' . "\r\n" . 'Reply-To: ' . $email;
			
			mail($emailTo, $subject, $body, $headers);

			$emailSent = true;
	}
} 
?>

<?php if(isset($emailSent) == true) { ?>
	<div class="ok_box">
		<h3>Thanks, <?php echo $name;?></h3>
		<p>Bitte klicken Sie hier um den Vorgang abzuschließen <a href="index.html">BEZAHLEN</a>.</p>
	</div>
<?php } ?>

<?php if(isset($hasError) ) { ?>
	<div class="error_box">
		There was an error submitting the form.
		<br />
		<?php echo $errorMessage;?>
	</div>
<?php } ?>
 
Du hast eh zu viele <?php ?> drin das ist zu unübersichtlich! //Meine persönliche Meinung!

Schau mal eins Post über dir! Da habe ich nen Lösungsvorschlag gepostet!
 
genau so hatte ich es dann auch probiert, aber es funktioniert leider nicht. Es passiert dann überhaupt nichts lediglich eine gestrichelte Linie erscheint über dem Sendebutton es kommt nicht einmal mehr der Dankestext mehr. In die URL habe ich zum TEST einfach mal http://www.ebay.de eingegeben. Wieß wirklich nicht mehr weiter, hätte mir nciht vorstellen können dass es so kompliziert wird... :)
 
Nunja, wenn du den Dankestext haben willst, lass es mit dem Button so wies war! Wenn du aber auf eine andere Seite um bzw. weiterleiten willst ->ist klar kommt die Ausgabe nicht, da diese entfernt wurde!

PHP:
<?
// edit these lines
$your_name="";
$your_email="";
$your_web_site_name="";
?>

<?php
//If the form is submitted
if(isset($_POST['name'])) {

//Check to make sure that the name field is not empty
if(trim($_POST['name']) === '') {
$hasError = true;
} else {
$name = trim($_POST['name']);
}

//Check to make sure sure that a valid email address is submitted
if(trim($_POST['email']) === '') {
$hasError = true;
} else if (!eregi("^[A-Z0-9._%-]+@[A-Z0-9._%-]+\.[A-Z]{2,4}$", trim($_POST['email']))) {
$hasError = true;
$errorMessage = "Please enter a valid email address!";
} else {
$email = trim($_POST['email']);
}

//Check to make sure that the phone field is not empty
if(trim($_POST['phone']) === '') {
$hasError = true;
} else {
$phone = trim($_POST['phone']);
}

//company name
$company_name = trim($_POST['company_name']);

//company url
$company_url = trim($_POST['company_url']);


//Check to make sure comments were entered
if(trim($_POST['message']) === '') {
$hasError = true;
} else {
if(function_exists('stripslashes')) {
$comments = stripslashes(trim($_POST['message']));
} else {
$comments = trim($_POST['message']);
}
}



//If there is no error, send the email
if(!isset($hasError)) {

$emailTo = $your_email;
$subject = 'Contact Form Submission from '.$name;

//message body
$body ="Name: $name \n\n";
$body .="Email: $email \n\n";
$body .="Phone:$phone\n\n";
$body .="Company Name:$company_name\n\n";
$body .="Company Url:$company_url \n\n";
$body .="Message: $comments";


$headers = 'From: '.$your_web_site_name.' <'.$emailTo.'>' . "\r\n" . 'Reply-To: ' . $email;

mail($emailTo, $subject, $body, $headers);

$emailSent = true;
}
}
?>

<?php if(isset($hasError) ) { ?>
<div class="error_box">
There was an error submitting the form.
<br />
<?php echo $errorMessage;?>
</div>
<?php } 
else
{
      header ("LOCATION: hier die URL");
      die;
}
?>

So sollte es aber gehen!
 
Funktioniert leider auch nicht... habe es mit ("LOCATION: http://www.akmuc.de"); probiert und nur mit www. es passiert gar nichts... nicht einmal eine fehlermeldung und email kommt auch keine an... verzweifelnd...
 
Hab ich gemacht, nun erscheint dann nach dem Absenden oben error_reporting(E_ALL); Eine Mail kommt nicht an auch wird nicht weitergelietiet...
 
Natürlich sorry, mein Fehler:

Hier die Fehlermeldungen:

Notice: Undefined index: company_name in /homepages/45/d77048884/htdocs/ebay/contact_form.php on line 39

Notice: Undefined index: company_url in /homepages/45/d77048884/htdocs/ebay/contact_form.php on line 42

Warning: Cannot modify header information - headers already sent by (output started at /homepages/45/d77048884/htdocs/ebay/contact_form.php:2) in /homepages/45/d77048884/htdocs/ebay/contact_form.php on line 91

Kannst Du damit was anfangen?

GLG
 

Neue Beiträge

Zurück