Jump to content

sunil.23143

New Members
  • Posts

    9
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

sunil.23143's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. hello, i m using the folloing javascript for all the forms of my web. This script works well for all the fields...but not for radio buttons due to the reason that i have two radio buttons of the same name. but if the radio button names are different the script works well.but due to some programming i cant give different names to two radio buttons.... # function MM_findObj(n, d) { # //alert(n) # //alert(d) # var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) { # d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} # if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n]; # for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); # if(!x && d.getElementById) x=d.getElementById(n); return x; # } # # function MM_validateForm() { # var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments; # //alert(args.length-2) # for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]); # //alert(val) # # if (val) { nm=args[i+1]; if ((val=val.value)!="") { # # // alert(val) # if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@'); # if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n'; # } else if (test!='R') { num = parseFloat(val); # if (isNaN(val)) errors+='- '+nm+' must contain a number.\n'; # if (test.indexOf('inRange') != -1) { p=test.indexOf(':'); # min=test.substring(8,p); max=test.substring(p+1); # if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n'; # } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; } # } # # //alert(document.getElementById('agreement1').value) # //alert(document.getElementById('agreement').value) # # //alert("work") # //if(document.referrer.getElementById('agreement1').value=='1') errors+='Must accept terms of conditions ref'; # # # //if(document.getElementById('agreement').value=='1') errors+='Must pt terms of conditions'; # # # # # if (errors) alert('The following error(s) occurred:\n'+errors); # # document.MM_returnValue = (errors == ''); # # } he form where i m applying this script is given below.if a field is blank, on submit a alert box appears conveying the information about field set black...this works well for the field "state" but not for the field "gender"....your sugestions are most welcomed......... 1. <table width="100%" border="0" cellspacing="0" cellpadding="0"> 2. <form name="register" action="index.php?mode=register" method="post" > 3. <tr> 4. <td colspan="4" class="form-main-bold">Create your account <span class="box-main-bold">Please give your login and brief personal details</td> 5. </tr> 6. 7. <tr> 8. <td align="left" valign="middle" class="box-main-bold">Gender : </td> 9. <td colspan="2" valign="top" class="form-text"><input name="gender" type="radio" id="gender" value="" /> 10. Male 11. <input type="radio" name="gender" id="gender" value="" /> 12. Female</td> 13. </tr> 14. <tr> 15. <td align="left" valign="top" class="box-main-bold">Current Location : 16. </td> <input type='text' class="textbox" name="state" id="state" value="" maxlength="20" />< /td> 17. </tr> 18. 19. <tr> 20. <td width="222" align="right" valign="middle" class="TextTD_Right"><input name="Submitregis" type="submit" class="button" id="Submitregis" value="Submit and Create Account " onClick="MM_validateForm('gender','Gender :','R','state','State :','R');return document.MM_returnValue" /></td> 21. </tr> 22. 23. </table> 24.
  2. hello friends, how to change value of a php session variable in javascript.....or can we acces or change the value of a php session variable in javascript
  3. ajax scrip working on IE but not on mozila fire fox....the script is given below...what can be the posible solutions..... <script type="text/javascript"> var xmlHttp function showUser(str) { xmlHttp=GetXmlHttpObject() if (xmlHttp==null) { alert ("Browser does not support HTTP Request") return } var url="http://merchant06.com/index.php" alert (url) url=url+"?q="+str alert (url) xmlHttp.onreadystatechange=stateChanged xmlHttp.open("GET",url,true) xmlHttp.send(null) } function stateChanged() { if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") { document.getElementById("txtHint").innerHTML=xmlHttp.responseText } } function GetXmlHttpObject() { var xmlHttp=null; try { // Firefox, Opera 8.0+, Safari xmlHttp=new XMLHttpRequest(); } catch (e) { //Internet Explorer try { xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); } } return xmlHttp; } </script>
  4. the problem is solved on Internet explorer but stilll exists on mozila firefox..... it is echod from http://merchant06.com/index.php
  5. hello friends i have two files one is index.php and other is login.tpl. i m using ajax in the login.tpl.ajax is working .but the problem is that once ajax sends the value to index.php...but the varibles assigned by index.php are not displayed in login.tpl...just check for fetch3 and fetch5...these are not displayed in lgin.tpl.. this is index.php <?php include "smarty.php"; include "config.php"; ini_set('display_errors', 1); error_reporting(E_ALL); session_start(); $sql="select * from employees "; $fetch3=fetch_mysql_query($sql); $q=$_GET["q"]; echo "abohar"; echo $q; echo $q; echo $q; echo $q; echo $q; echo $q; $sql="select * from employees where emp_id='$q'"; $fetch5=fetch_mysql_query($sql); $cnt=count ($fetch5); echo "the cont".$cnt."this"; if(isset($_REQUEST['Submit'])) { echo "sunil abohar"; //echo $mode; $email=$_REQUEST['email']; $pass=$_REQUEST['pass']; echo $email; echo $pass; $sql="select * from employees where email='$email' and pass='$pass'"; $fetch=fetch_mysql_query($sql); $cnt=count ($fetch); //echo $cnt; echo $fetch[0][0]; if($cnt==0) { $error='* Invalid Email address or Password !'; $smarty->assign('error',$error); $mode=""; echo "nvalid Email address or Password !"; break; } else { if($fetch[0][19]=='suspended') { $error1='* Your account is currently suspended.You can contact the administrator for account activaton !'; $smarty->assign('error1',$error1); $mode=""; } else { $_SESSION['iidd']=$fetch[0][0]; $_SESSION['name2']=$fetch[0][1]; $mode="userlogin"; echo $mode; $email="sunil_abohar123@yahoo.co.in"; echo $email; } } } $login=$_SESSION['iidd']; if($login != '') { $mode=$_REQUEST['mode']; } else { $mode=""; } echo "hum"; echo $fetch4[0][1]; echo $mode; switch($mode) { case('userlogin'): { echo"fdhggggggggbyvdhhdhdfukg"; echo $mode; if(isset($_REQUEST['Submit'])) { echo "sk abohar"; echo $mode; $email=$_REQUEST['email']; $pass=$_REQUEST['pass']; echo $email; echo $pass; $sql="select * from employees where email='$email' and pass='$pass'"; $fetch=fetch_mysql_query($sql); $cnt=count ($fetch); //echo $cnt; echo $fetch[0][0]; if($cnt==0) { $error='* Invalid Email address or Password !'; $smarty->assign('error',$error); $mode=""; echo "nvalid Email address or Password !"; break; } else { if($fetch[0][19]=='suspended') { $error1='* Your account is currently suspended.You can contact the administrator for account activaton !'; $smarty->assign('error1',$error1); $mode=""; } else { $_SESSION['iidd']=$fetch[0][0]; $_SESSION['name2']=$fetch[0][1]; $mode="userlogin"; echo $mode; unset($_REQUEST['Submit']); echo $_REQUEST['Submit']; $email="sunil_abohar123@yahoo.co.in"; echo $email; $format="%H:%M:%S"; $login_t=strftime($format); $_SESSION['login_time1']=$login_t; echo time(); $_SESSION['login_time']=time(); echo $_SESSION['login_time']; //echo strtotime($_SESSION['login_time']); $rep_id=$_SESSION['iidd']; //echo $login_t; //echo $rep_id; $date_today=date('Y-m-d'); echo $date_today; echo $date_today; $sql="insert into reports (rep_id,login_t,logout_t,total_dur,date_today) values('$rep_id','$login_t','$logout_t','$total','$date_today')"; exec_mysql_query($sql); $sql1 = "Select login_t,logout_t,total_dur from reports where rep_id='$rep_id' and date_today='$date_today'"; $display1=fetch_mysql_query($sql1); $cnt=count($display1); $sql1 = "SELECT sum(total_dur) from reports where rep_id='$rep_id' and date_today='$date_today'"; $display2=fetch_mysql_query($sql1); $cnt=count($display2); echo "ferozpur"; echo $cnt; echo $cnt; echo $cnt; echo $cnt; break; } } } break; } case("employee"): { echo "dfsfdhjfjsdgkdffffffffffffffffffffffffffffffffffffff"; break; } case("logout1"): { $format="%H:%M:%S"; $logout_t=strftime($format); //echo //echo $logout_t; //echo $_SESSION['login_time']; $total_dur=time()-$_SESSION['login_time']; //echo strtotime($logout_t); //echo $_SESSION['login_time']; //echo strtotime("$_SESSION['login_time']"); echo "hellologout".$total_dur."hilogout"; $rep_id=$_SESSION['iidd']; $login_t=$_SESSION['login_time1']; $sql="update reports set logout_t='$logout_t', total_dur=(SELECT SEC_TO_TIME($total_dur)) where rep_id='$rep_id' and login_t='$login_t'"; exec_mysql_query($sql); session_unset(); session_destroy(); unset($_REQUEST['Submit']); //echo $_REQUEST['Submit']; $mode=''; $log='* You are logged out !'; break; } } echo "hum"; echo $fetch4[0][1]; echo "hum"; echo $fetch4[0][1]; echo "hum"; echo $fetch4[0][1]; echo "hum"; echo $fetch3[0][1]; echo "hum"; echo $fetch3[0][1]; echo "hum"; echo $fetch5[0][2]; $smarty->assign('fetch3',$fetch3); $smarty->assign('fetch4',$fetch4); $smarty->assign('fetch5',$fetch5[0][2]); $smarty->assign('log',$log); $smarty->assign('display1',$display1); $smarty->assign('display2',$display2); $smarty->assign('b',$_SESSION['name2']); $smarty->assign("mode",$mode); $smarty->display("index.tpl"); ?> this is login.tpl {literal} <script type="text/javascript"> var xmlHttp function showUser(str) { xmlHttp=GetXmlHttpObject() if (xmlHttp==null) { alert ("Browser does not support HTTP Request") return } var url="http://merchant06.com/index.php" alert (url) url=url+"?q="+str alert (url) xmlHttp.onreadystatechange=stateChanged xmlHttp.open("GET",url,true) xmlHttp.send(null) } function stateChanged() { if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") { document.getElementById("txtHint").innerHTML=xmlHttp.responseText } } function GetXmlHttpObject() { var xmlHttp=null; try { // Firefox, Opera 8.0+, Safari xmlHttp=new XMLHttpRequest(); alert ("1") } catch (e) { //Internet Explorer try { xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); } } return xmlHttp; } </script> {/literal} <table width="100%" border="0" cellpadding="5" cellspacing="0" class="border"> <form name="userl" action="index.php?mode=userlogin" method="post"> <tr> <td height="5" colspan="2" align="center" valign="middle" bgcolor="#990000"></td> </tr> {if $log eq '<span align="center" style="color:#0000FF"><b> * You are logged out ! </b> </span>'} <tr> <td height="25" colspan="2" align="center" valign="middle" bgcolor="#f5f3f4" class="blacktext">{$log}</td> </tr> {/if} {if $forget eq '<span align="center" style="color:#0000FF"><b> * Your password has been sent to your email ! </b> </span>'} <tr> <td height="25" colspan="2" align="center" valign="middle" bgcolor="#f5f3f4" class="blacktext">{$forget}</td> </tr> {/if} <tr> <td height="25" colspan="2" align="center" valign="middle" bgcolor="#f5f3f4" class="blacktext">Login {$fetch5}</td> </tr> <tr> <td colspan="2" align="center" valign="middle" class="phno">{$error}{$error1}</td> </tr> <tr> <td width="49%" align="right" valign="middle" class="bodytext">User Email : </td> <td width="51%" align="left" valign="top"> <form name="userl" action="index.php?mode=employee" method="post"> <select name="str" onchange="showUser(this.value)"> <option value="1">Employee ID</option> {section name=i loop=$fetch3} <option value="{$fetch3[i].emp_id}">{$fetch3[i].name}</option> {/section} </select> </form> <p> <div id="txtHint"><b> your infromgg {$fetch5} {section name=i loop=$fetch3} <td>hello {$fetch3[i].name}<td> {/section} </b></div> </p> </td> </tr> <tr> <td align="right" valign="middle" class="bodytext">{$fetch5}</td> <td align="left" valign="top"><input name="pass" type="password" class="text-box" id="pass"></td> </tr> <tr> {section name=i loop=$fetch4} <td width="49%" align="right" valign="middle" class="bodytext">log status : "{$fetch4[i].log_status}" is </td> {/section} <td width="51%" align="left" valign="top"> <select name="log_status"> {section name=i loop=$fetch4} <option value="{$fetch4[i].emp_id}" selected="selected">{$fetch4[i].log_status}</option> {/section} </select> </td> </tr> <tr> <td align="left" valign="top"> </td> <td align="left" valign="top"><input name="Submit" type="submit" class="button" value="Login" onClick="MM_validateForm('email','Email Address :','RisEmail','pass','Password :','R');return document.MM_returnValue"></td> </tr> <tr> <td colspan="2" align="center" valign="top"><a href="index.php?mode=forgetpass1">Forgot Password </a></td> </tr> </form> </table>
  6. hello freinds, i have a tpl named freetrial.tpl..In the form action ,i have given the action..<form name="form1" action="index2.php?mode=freetrial1" method="post"> ...but the acton goes to a another file ...index.php.... what can the possible solutions......
  7. Do you want to keep working using php or you want to switch to .NET or java?
  8. how to make a table having different fields to keep record of differnt users on different dates? i m making a table having three field chest,waist and arm.now i m to add two more fields users and date, so that i can enter the records of different users on different dates....
  9. HELLO FRIENDS............. what is the best book by sams to learn php? plzz reply soon............
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.