Potrzebuje pomocy zeby wyjasnic mi dlaczego formularz w php nie chce nawiazac polaczenia do funkcji ktora jest zrobiona w javascripcie.
Tutaj jest 1kod:
Kod
<form name="the_form" method="post" action="frame_administrator.php" class="army" onSubmit="var the_result = multti(); return the_result;" >
<table border="1">
<tr>
<td>Login: </td>
<td><input type="text" name="new_login" maxlength="20"></td>
</tr>
<tr>
<td>Hasło: </td>
<td><input type="password" name="new_password" maxlength="20"></td>
</tr>
<tr><td colspan="2"><hr></td></tr>
<tr>
<td>Imie </td>
<td><input type="text" name="new_firstname" maxlength="20"></td>
</tr>
<?php
mysql_close($mysql_confirm);
?>
<tr>
<td colspan="2" style="text-align:center;"><input type="submit" value="Dodaj nauczyciela"></td>
</tr>
</table>
</form>
<table border="1">
<tr>
<td>Login: </td>
<td><input type="text" name="new_login" maxlength="20"></td>
</tr>
<tr>
<td>Hasło: </td>
<td><input type="password" name="new_password" maxlength="20"></td>
</tr>
<tr><td colspan="2"><hr></td></tr>
<tr>
<td>Imie </td>
<td><input type="text" name="new_firstname" maxlength="20"></td>
</tr>
<?php
mysql_close($mysql_confirm);
?>
<tr>
<td colspan="2" style="text-align:center;"><input type="submit" value="Dodaj nauczyciela"></td>
</tr>
</table>
</form>
Tutaj jest 2 kod:
Kod
<script type="text/javascript">
function multti()
{
var error_string ="";
var new_login=window.document.the_form.new_login.value;
var new_password=window.document.the_form.new_password.value;
var new_surname=window.document.the_form.new_surname.value;
var blad_alfabet=/a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|r|s|t|u|v|x|y|z/;
if (new_login=="")
{
error_string +="Musisz podac login.\n";
}
if(new_password=="")
{
error_string += "Musisz podac haslo.\n";
}
if(new_firstname=="")
{
error_string += "Musisz podac imie.\n";
}
if(blad_alfabet.test(new_name)==true && new_name!="")
{
error_string += "Musisz podac poprawny format imiona.\n";
}
if (error_string == "")
{
return true;
}
else
{
error_string = "W formularzu brakuje nastepujacych informacji: \n" + error_string;
alert(error_string);
return false;
}
}
</script>
function multti()
{
var error_string ="";
var new_login=window.document.the_form.new_login.value;
var new_password=window.document.the_form.new_password.value;
var new_surname=window.document.the_form.new_surname.value;
var blad_alfabet=/a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|r|s|t|u|v|x|y|z/;
if (new_login=="")
{
error_string +="Musisz podac login.\n";
}
if(new_password=="")
{
error_string += "Musisz podac haslo.\n";
}
if(new_firstname=="")
{
error_string += "Musisz podac imie.\n";
}
if(blad_alfabet.test(new_name)==true && new_name!="")
{
error_string += "Musisz podac poprawny format imiona.\n";
}
if (error_string == "")
{
return true;
}
else
{
error_string = "W formularzu brakuje nastepujacych informacji: \n" + error_string;
alert(error_string);
return false;
}
}
</script>
Ten 2 kod znajduje sie powyzej formularza w sekcji <head> ...</head>
Prosze o pomoc