If your function "CheckNumber( $numero )" validates true, the script is going to out put your JavaScript, but the JavaScript will NOT change your php values no matter what the user selects.
Wagner Marini wrote:
JavaScrip and PHP together Hey ALL, I really do not understand what's going on. In my code below I try to inform the user that the number added to him already exists in database but in my JavaScrit's if-else the line "<?php $tst = TRUE; ?>" ever run, even the user wants to add the number. What's happened??Thanks, WMarini/ ---------------------------------------------------------------------------- --- ... <body> <?php $tst = FALSE; ... $contact_ins = "insert into contato (nome) values ('$name');"; mysql_query( $contact_ins ) OR die( mysql_error() ); //Check if numero exists. if( CheckNumber( $numero ) ) { ?> <script language="JavaScript"> if ( window.confirm("Number to be added exists.\nContinue?") ) { //The user wants to add the number defined. <?php $tst = FALSE; ?> break; } else { //User does not want to add the number. <?php $tst = TRUE; ?> ; } </script> <?php } if( $tst == FALSE ) { //Add the number, Don't care! ... } ... ?> </body> </html> ---------------------------------------------------------------------------- --- -- Wagner Marini ----
-- By-Tor.com It's all about the Rush http://www.by-tor.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php