ugrás a tartalomhoz

javascript ből xml ürlapon php bejelentkezés mysqlbe :D bocsi

Pisti20 · 2009. Okt. 10. (Szo), 10.20
Halli!

Lenne egy kérdésem.

Szóval van egy űrlapom, amiben van egy account és egy password name-vel rendelkező input. Arról lenne szó, hogy hogyan tudom javascriptből megadni ezeket az értékeket,
és el is küldeni a phpnak, ami aztán már vizsgálja mysql táblából majd stb.
A lényeg hogy miért nem küldi ez most el a php-nak?

De azt is kérdezhetem, hogy hol a hiba(a document.myform.submit() egy netes oldalról jött bele, nem tudom az a rész hibás-e.):
<script type="text/javascript" language="javascript">
var user="";
var pass="";

while (((user.length)<4) || ((pass.length)<5))
{
user=prompt("Felhasználónév:");
pass=prompt("jelszó:");
}


alert("Felhasználónév:\n" + user + "\n" + "Jelszó:\n" + pass);
document.myform.account.value=user;
document.myform.password.value=pass;
alert("Felhasználónév=:\n" + user + "\n" + "Jelszó:\n" + pass);
document.myform.submit();
</script>
<form name="myform" method="POST">
<input type="hidden" name="account" />
<input type="hidden" name="password" />
</form>
<?php
$account=$_POST['account'];
$password=$POST['password'];

print("felhasználónév:<br />" . $account . "<br />jelszó:<br />" . $password);
?>

Azért ennyi csak, mert egyenlőre szerettem volna megnézni hogy átadja e az értékeket.
 
1

Próba

Poetro · 2009. Okt. 10. (Szo), 10.34
Az alábbi nálam működik, a PHP részét nem próbáltam, de a formot tuti elküldi.
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">  
  2. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">  
  3. <head>  
  4.     <title><!-- Insert your title here --></title>  
  5. </head>  
  6. <body>  
  7.   
  8. <?php  
  9. $account = $_POST['account'];  
  10. $password = $POST['password'];  
  11.   
  12. print("felhasználónév:<br />" . $account . "<br />jelszó:<br />" . $password);  
  13. ?>  
  14.   
  15. <form method="post" action="" id="myform">  
  16.   <input type="hidden" name="account" id="account" />  
  17.   <input type="hidden" name="password" id="password" />  
  18. </form>  
  19. <script type="text/javascript" language="javascript">  
  20. var user="";  
  21. var pass="";  
  22.   
  23. while (user.length < 4 || pass.length < 5) {  
  24.   user = prompt("Felhasználónév:");  
  25.   pass = prompt("jelszó:");  
  26. }  
  27. document.getElementById('account').value = user;  
  28. document.getElementById('password').value = pass;  
  29. document.getElementById('myform').submit();  
  30. </script>  
  31. </body>  
  32. </html>  
2

THX

Pisti20 · 2009. Okt. 10. (Szo), 11.15
Köszi, nem ismerem még, de ebbe beleásom magam.
Praktikus úgylátom. THX még1x
3

most így egyben egy végtelen ciklus lett

Pisti20 · 2009. Okt. 10. (Szo), 11.18
SAJNOS :D a phpval együtt végtelen ciklus lett belőle :D