Problem mit foreach

Mit der POST Var. mach ich nix.
Das Formular sieht so aus:
HTML:
<form action="index.php?site=protect" method="post">
Ordnername: <input type="text" name="folder" /><br />
Passwort: <input type="text" name="password" /><br />
Links: <textarea name="links" cols="50" rows="7"></textarea><br />
<input type="submit" name="protect" value="Protect" />
</form>
 
Hi,

Mit der POST Var. mach ich nix.
Das Formular sieht so aus:
HTML:
<form action="index.php?site=protect" method="post">
Ordnername: <input type="text" name="folder" /><br />
Passwort: <input type="text" name="password" /><br />
Links: <textarea name="links" cols="50" rows="7"></textarea><br />
<input type="submit" name="protect" value="Protect" />
</form>

das kann nicht sein. Wenn ich das Formular so übernehme, sieht print_r($_POST) bei mir so aus:

Code:
Array
(
    [folder] => fdgfdg
    [password] => dfgfdg
    [links] => fdgfdg
fdgfdg
fdgfdg
fdgfd
    [protect] => Protect
)

An welcher Stelle hattest Du das eingesetzt?
Übrigens solltest Du die Ausgabe von print_r nicht aus der Browseranzeige kopieren, sondern aus dem Quelltext. Da ist das dann schön mit Zeilenumbrüchen und Einrückungen formatiert.

LG
 
Also das ist wirklich komisch, jetzt hab ich eine neue PHP Datei angelegt, ohne Smarty usw und da funktioniert es.
Ich verstehe nicht, woran das liegen kann...
 
Code:
PHP:
<?php

$page = "protect.tpl";

if(isset($_POST['protect']))
{
	if($_POST['links'] != '')
	{	
		$links = explode("\n", $_POST['links']);
		print_r($_POST);
		
		$tpl->assign("submit", 1);
		$tpl->assign("msg", "Eingetragen");
	}
	else
	{
		$tpl->assign("msg", "Bitte geben Sie LInks ein");	
	}
}
else
{
	$tpl->assign("submit", 0);
}

?>

Quelltext:
HTML:
Array
(
    [folder] => 
    [password] => alex
    [links] => http://google.de
http://tutorials.de
http://google.com
    [protect] => Protect
)
Array
(
    [folder] => 
    [password] => alex
    [links] => http://google.de
http://tutorials.de
http://google.com
    [protect] => Protect
)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Link Protection</title>
</head>

<b>Eingetragen</b>
<br /><br />


<body>
</body>
</html>
 
Hi,

ich kenne Smarty nicht, aber das sieht so aus, als würde der print_r-Befehl zweimal ausgeführt. Warum machst Du da überhaupt eine foreach-Schleife mit echo? Das würde doch ins Template gehören.

LG
 
Zurück