Hallo FirstDefender,
du kannst Prüfungen auch ohne Java machen.
Hier ein Beispiel zum testen etc.: (Bei mir "name.php")
PHP-Code:
<head>
<title> Name Test </title>
</head>
<body>
<h1> Name Test </h1>
<?php
function buchstaben($teststring){
if (ereg ("([^A-Za-zÄäÖöÜüß \.-]+)", $teststring)) { return true; } else { return false; };
}
if(isset($_POST['ueberpruefung']))
{
$allesok = 1;
if(buchstaben($_POST['Name']))
{
$allesok = 0;
$error[Name] = "<font color='red'>Only letters!</font>";
}
if(empty($_POST['Name']))
{
$allesok = 0;
$error[Name] = "<font color='red'>No Name?</font>";
}
//hier kann alles mögliche geprüft werden...z.B. andere Reguläre Ausdrüke ...//
}
if($allesok)
{
echo "<h2> Confirm </h2>";
echo "Name --- ".$_POST['Name']."<br>";
echo "<Form Post Submit....>";
//hier kann es weiter gehen...Übergabe an E-Mail, Liste, Datenbank... //
}
else
{
?>
<p><strong> Please fill out the following form completly. <font color='red'>*</font> is controlled!</strong></p>
<form name="Registration" method="post" action="<?php echo $_SERVER['PHP_SELF']?>">
<table>
<tr>
<td> <font color='red'>*</font> Name</td>
<td><input type="text" name="Name" size="40" value="<?php echo $_POST['Name'];?>" />
<?php echo $error['Name'];?> </td>
</tr>
<tr>
<td>
<input type="hidden" name="ueberpruefung" value="1">
<input type="submit" name="Registration" value="Send" />
</td>
<td><input type="reset" name="Zurücksetzen" value="Delete" /> </td>
</tr>
</table>
</form>
<?php
}
?>
</body>
Es werden Zahlen und ein Leerfeld nicht angenommen.
Ich hoffe das hilft dir weiter...