473,407 Members | 2,359 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

I need to initialise PHP Variable inside javascript??

The below code is an javascript funution . I need to initialise PHP variable in the else part of it pls do help me



Expand|Select|Wrap|Line Numbers
  1. function validate(){
  2.  
  3.    if(document.loginForm.vuser_login.value==""){
  4.  
  5.       alert("Login Name name cannot be empty");
  6.       document.loginForm.vuser_login.focus();
  7.       return false;
  8.  
  9.     }else if(document.loginForm.vuser_password.value==""){
  10.  
  11.       alert("Password cannot be empty");
  12.       document.loginForm.vuser_password.focus();
  13.       return false;
  14.  
  15.     }else{
  16. //here i need to initialise ($act) PHP variable
  17.     return true;
  18.  
  19.     }
  20.  
  21. }
Dec 7 '10 #1
2 1604
Dormilich
8,658 Expert Mod 8TB
I need to initialise PHP variable in the else part of it
you can’t. PHP is executed on the server while JavaScript is executed on the client (the browser). that is, when JavaScript is executed, PHP already finished and is not working any more.
Dec 7 '10 #2
dlite922
1,584 Expert 1GB
For More Info: http://www.php.net/manual/en/faq.htm...cript-variable

Dan
Dec 7 '10 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Matt | last post by:
Is it possible to put XSL instructions inside JavaScript? For example, pop up a message box with the xml value: alert(value in xml); Approach #1: <script type="text/javascript">...
1
by: Frederik S | last post by:
Hi all, Is it possble to do a HTTP post request inside JavaScript? - That is I don't want to use a HTML FORM, but need a JavaScript to post a value to a PHP script not encoding the parameters...
1
by: Matt Jensen | last post by:
Howdy I'm hoping to put a variable inside a variable name. In JavaScript, you would use eval(myvar+i) or something like that. What is the C# equiavlent of eval? Or how do I do it in C# .NET? ...
0
by: Dave | last post by:
Hi , I have the following where I need to append a string variable inside a hyperlink template, inside a datalist. The variable 'categoryList' is the culprit. No matter where this variable is...
2
by: Augusto Cesar | last post by:
Hello people. How can I Pass ASP Array variable to Javascript; I´m to trying this: <script language="JavaScript"> var x = new Array(10);
5
by: Jade | last post by:
I saw some web page saying I could do it this way in javascript: var iNumber = <%#publicvarname publicpropertyname %> but it doesn't seem to work. I have this piece of code here in...
1
by: saurabhjj | last post by:
hi, i want use a jsp session variable inside a javascript code, for this i am using the following function, function checkList() { <% String ecode1=(String)session.getAttribute("e_numb");...
3
by: jessy | last post by:
can anyone heLp me i need to send an id to a page through a javascript function but it wont work he can't read the variable function confirm_delete() { var answer=confirm("Are You...
4
Dheeraj Joshi
by: Dheeraj Joshi | last post by:
Hi, I was wondering is there any technique available, so we can access the global variable inside a function if we have a local variable inside the function with the same name as global variable. ...
0
by: AshishatSAP | last post by:
Hi JSP experts, I am having a JSP in my project which has some scriptlet code in the start and then javascript follows. Inside the javasript the values of variables defined inside the scriptlet code...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.