dev-exchange.com logo

dev-exchange.com topic RSS feed

Book mark: Add http://www.dev-exchange.com/viewtopic.php?t=743&start=0&postdays=0&postorder=asc&highlight= to your delicious account Add http://www.dev-exchange.com/viewtopic.php?t=743&start=0&postdays=0&postorder=asc&highlight= to your digg account Add http://www.dev-exchange.com/viewtopic.php?t=743&start=0&postdays=0&postorder=asc&highlight= to your blinklist account Add http://www.dev-exchange.com/viewtopic.php?t=743&start=0&postdays=0&postorder=asc&highlight= to your reddit account Add http://www.dev-exchange.com/viewtopic.php?t=743&start=0&postdays=0&postorder=asc&highlight= to Dzone Add http://www.dev-exchange.com/viewtopic.php?t=743&start=0&postdays=0&postorder=asc&highlight= to your furl account Add http://www.dev-exchange.com/viewtopic.php?t=743&start=0&postdays=0&postorder=asc&highlight= to your stumble account Add http://www.dev-exchange.com/viewtopic.php?t=743&start=0&postdays=0&postorder=asc&highlight= to your Yahoo myweb account
what should i do to give alert box for invalid security code

 
Post new topic   Reply to topic   printer-friendly view    dev-exchange.com Forum Index -> PHP
View previous topic :: View next topic  
Author Message
rathurosamal
Junior Member
Junior Member


Joined: 21 Jul 2009
Posts: 1
Location: Kuwait

PostPosted: Tue Jul 21, 2009 10:58 am    Post subject: what should i do to give alert box for invalid security code Reply with quote

I am trying to do form validation through javascript and captcha using php.
when i try to alert for ivalid security code, i cant see the alert box. if icode is correct, page is redirecting to the next page.
what should i do to give alert box for invalid security code??
my form code is

Code: Select all
<input type="submit" name="submit" value="submit" onclick="chk();">



chk is a javascript function

Code: Select all
function chk()
{
alert("<?php chk1(); ?>");

}



it is calling a function named chk1. it is php function

Code: Select all
<?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";


} }
?
_________________
Learning software
Back to top
View user's profile Send private message
Kishore
Contributing Member
Contributing Member


Joined: 20 Feb 2007
Posts: 200
Location: Banglore , India

PostPosted: Tue Jul 21, 2009 9:42 pm    Post subject: Reply with quote

you are trying to call server side php using java script which is not correct. if you want to call a server side script from client side, you need to use Ajax and this is a different topic. for you here is the simple example for creating captcha, http://www.codewalkers.com/c/a/Miscellaneous/Creating-a-CAPTCHA-with-PHP/

..
_________________
=================
Kish
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    dev-exchange.com Forum Index -> PHP All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


© 2008 dev-exchange.com
Powered by phpBB. Theme DEVPPL.