Thread: help plsss :(
View Single Post
  #1 (permalink)  
Old 07-04-09, 05:06 AM
shemi shemi is offline
Newbie Coder
 
Join Date: Jul 2009
Location: india
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
help plsss :(

hi to all.
i am trying to do form validation through javascript and captcha using php.
when i try to alert for invalid security code, if thecode is correct also, it is giving alert boxes of invalid code and when i click ok button, page is redirecting to the next page.

my form code is
<input type="submit" name="submit" value="submit" onclick="chk();">


chk is a javascript function
PHP Code:

function chk()
  {
  alert("<?php chk1(); ?>");
 
   }
it is calling a function named chk1. it is php function
<?php 
function chk1()
{
 
   if( 
$_SESSION['security_code'] == $_POST['security_code']  )
    {
         
        echo 
'Thank you.code is valid';
        
          
header("Location: process.php"); 
     
   } else {
                 print 
"enter correct security code";

         
   } }  
?>

Last edited by shemi; 07-04-09 at 05:24 AM.
Reply With Quote