How to send variables from javascript to php - Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more
Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more
Go Back   Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more > Webmaster Tech > Programming > PHP Development

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 03-18-2010, 02:23 AM   #1 (permalink)
Junior Member
 
Cindy Sable's Avatar
 
Join Date: Dec 2009
Posts: 32
Default How to send variables from javascript to php

how to send java script variables to php. There is an username and password in the form of javascript variables.i want to check this username and password from mysql database. For that i need to save this javascript variables to php and then php can communicate with mysql for validation. Untill entering correct password all other fields in the form should be disabled.pls anybody guide me.
Cindy Sable is offline   Reply With Quote
Sponsored Links
Old 03-20-2010, 01:58 PM   #2 (permalink)
Junior Member
 
Join Date: Mar 2010
Posts: 3
Default Re: How to send variables from javascript to php

hmm i wonder if something like
JS:
document.getElementByid("password").value = jsVar1;
HTML:
<form method="GET" action="action.php">
<input id="Password" name="password" value="">
...
</form>

PHP:
$phpVar = $_GET["password"]
would work.
Erik_M is offline   Reply With Quote
Old 03-28-2010, 02:48 AM   #3 (permalink)
Junior Member
 
Join Date: Mar 2010
Posts: 5
Default Re: How to send variables from javascript to php

Thanx for the valuable information
JulietMylaOwen is offline   Reply With Quote
Old 03-28-2010, 03:49 PM   #4 (permalink)
Member
 
novintabligh's Avatar
 
Join Date: Mar 2010
Posts: 106
Send a message via Yahoo to novintabligh
Default Re: How to send variables from javascript to php

you can also directly call php file like follow:

<script source="action.php?password=".jsVar1>

PHP:
$phpVar = $_GET["password"]
novintabligh is offline   Reply With Quote
Old 08-05-2010, 02:47 AM   #5 (permalink)
Junior Member
 
manzar's Avatar
 
Join Date: Jul 2010
Posts: 53
Default Re: How to send variables from javascript to php

its possible because PHP is parsed server side and Javascript is parsed client side. The PHP is always parsed "before" the page is shown to the client in other words.
manzar is offline   Reply With Quote
Old 09-13-2010, 04:14 PM   #6 (permalink)
Regular User
 
Join Date: Sep 2010
Posts: 30
Default Re: How to send variables from javascript to php

AJAX can also be used.
PradeepKr is offline   Reply With Quote
Old 12-24-2010, 01:38 AM   #7 (permalink)
Junior Member
 
Join Date: Dec 2010
Posts: 26
Default Re: How to send variables from javascript to php

its server side, because PHP can be analyzed and discussed are client-side JavaScript. PHP is always interpreted "before" the page is displayed to the customer in other words.
smith7868 is offline   Reply With Quote
Old 12-28-2010, 02:45 AM   #8 (permalink)
Junior Member
 
Join Date: Dec 2010
Posts: 29
Default Re: How to send variables from javascript to php

At this point in time the only way to do this is through AJAX. Send a javascript variable to a php page through AJAX, then the php ajax page will use the $_GET['info'] function to get the javascript variable. Then do whatever you want with that new information. This is very good to use when saving info to a database without having to reload.

______________________________________
RVs For Sale
Classic Cars For Sale

Last edited by Maxy28; 12-28-2010 at 02:53 AM.
Maxy28 is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Sponsors

» Links

» Affiliates
Web Hosting
Online Backup Reviews
Marketing Find
Merchant Select
SiteMap Builder
Host Compare

» Links

» Sports Network
Paintball Forum
Football Forum
Hockey Forum
Golf Forum
Boxing Forum
Lacrosse Forum
Baseball Forum
SnowBoarding Forum
Soccer Forum
MMA Forum


All times are GMT -4. The time now is 07:48 PM.


Powered by vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.2
Webmaster Forums
Web Hosting | Chicago Web Hosting | Web Hosting