Chce zrobić prosty formularz a nastepnie wypisać wprowadzone dane na inna strone.
kod html:
Kod: Zaznacz cały
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>szósty przykład - weryfikacja formularza</title>
<script type="text/javascript">
function onKeyPressValidate(e)
{
var ValidChars = "0123456789";
var key = window.event ? e.keyCode : e.which; //IE i Mozilla inaczej obsluguja zdarzenia
var keychar = String.fromCharCode(key);
return (ValidChars.indexOf(keychar) != -1);
}
function verify(_f)
{
if((_f.imie.value==null)||(_f.imie.value.length==0))
{
alert("Trzeba wypełnić pole IMIĘ!");
return false;
}
else
return true; //tu mozna uzyc dialogu confirm(komunikat), zeby ostatecznie potwierdzic tresc pol formularza
}
</script>
</head>
<body>
<form action="z6.php" method="get" onsubmit="return verify(this);">
Imię: <input type="text" name="imie">
<br>
Wzrost: <input type="text" name="wzrost" onkeypress="return onKeyPressValidate(event);">
<br>
E-mail: <input type="text" name="email">
<br>
<input type="submit" value="Wyślij">
</form>
</body>
</html>
Kod: Zaznacz cały
<?
echo "Przesłano:<br>";
echo $_GET['imie']."<br>";
echo $_GET['wzrost']."<br>";
echo $_GET['email']."<br>";
?>
Prosze o pomoc....