mijn php form werkt niet goed

Gesloten
websmoker
Berichten: 1
Lid geworden op: 29 jul 2016, 11:56

mijn php form werkt niet goed

Bericht door websmoker » 29 jul 2016, 12:06

Code: Selecteer alles

<head>
<title> Form</title>	
</head>
<body>
<h1>Send Us Your order details!</h1>
<form action="send_mail.php" method="post">
<table>
</tr>
<tr>
<td>Name:</td>
<td>
<input type="text" name="yorname" value="" maxlength="100" size="20" />
</td>
</tr>
<tr>
<td>Email Adress:</td>
<td>
<input type="text" name="email_address" value="" maxlength="100" size="20" />
</td>
</tr>
<tr>
<td>Order number:</td>
<td>
<input type="text" name="comments" value="" maxlength="100" size="20" />
</td>
<tr><td>&nbsp;</td>
<td>
<input type="submit" style="font-size: 36pt" value="Submit" />
</td>
</tr>
</table>
</form>
</body>
</html>

Mijn PHP code
========
<?php
// This function checks for email injection. Specifically, it checks for carriage returns - typically used by spammers to inject a CC list.
function isInjected($str) {
	$injections = array('(\n+)',
	'(\r+)',
	'(\t+)',
	'(%0A+)',
	'(%0D+)',
	'(%08+)',
	'(%09+)'
	);
	$inject = join('|', $injections);
	$inject = "/$inject/i";
	if(preg_match($inject,$str)) {
		return true;
	}
	else {
		return false;
	}
}

// Load form field data into variables.
$email_address = $_REQUEST['email_address'] ;
$comments = $_REQUEST['comments'] ;
$yourname = $_REQUEST['yourname'] ;


// If the user tries to access this script directly, redirect them to feedback form,
if (!isset($_REQUEST['email_address'])) {
header( "Location: feedback_form.html" );
}

// If the form fields are empty, redirect to the error page.
elseif (empty($email_address) || empty($comments)) {
header( "Location: error_message.html" );
}

// If email injection is detected, redirect to the error page.
elseif ( isInjected($email_address) ) {
header( "Location: error_message.html" );
}

// If we passed all previous tests, send the email!
else {
mail( "info@mijn mail.nl", " Form Results",
$yourname, $comments, "From: $email_address" );
header( "Location:thankyou.html" );
}
?>
vraag:
=========

Code: Selecteer alles

// Load form field data into variables.
$email_address = $_REQUEST['email_address'] ;
$comments = $_REQUEST['comments'] ;
$yourname = $_REQUEST['yourname'] ;
de tekst van- yourname is niet meegezonden in de email naar mij, wel de comments
Iemand enig idee?

Jim
Berichten: 3900
Lid geworden op: 21 feb 2007, 14:53
Locatie: Groningen
Contacteer:

Re: mijn php form werkt niet goed

Bericht door Jim » 29 jul 2016, 14:11

Hallo, welkom op phpBB.nl! :)

Dit is een website voor ondersteuning voor de forumsoftware phpBB, die is geschreven in de programmeertaal PHP. Wij zijn echter geen PHP ondersteuningsforum. Dus ik denk dat je hier op de verkeerde plaats bent met je vraag, tenzij dit toch iets met phpBB te maken heeft. Is dat het geval?
Jim Mossing Holsteyn - Beheerder
Documentatie | Algemene voorwaarden | Wiki

Heb je suggesties over het verbeteren van phpBB.nl of andere site-gerelateerde vragen? Stuur me een PB!

Gebruikersavatar
Ger
Berichten: 4864
Lid geworden op: 03 jan 2006, 22:23
Locatie: 192.68.1.100
Contacteer:

Re: mijn php form werkt niet goed

Bericht door Ger » 29 jul 2016, 14:20

Dit heeft inderdaad niets met phpBB te maken.
slotje
- Ger
PS: er zijn meerdere mensen die problemen hebben met je script. Zie bijvoorbeeld http://stackoverflow.com/questions/2527 ... error-page
Mijn advies: gebruik het gewoon niet.

Gesloten