473,320 Members | 2,133 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,320 software developers and data experts.

How can I pass Javascript variables to PHP variables?

13
Hi i need help i want to pass javascript variable to php. here's my sample code its not working. please someone help me....


[HTML]<select name='dbPages' OnChange='getLayoutID(this.value)'>
<option value='' selected> [Select]</option>
<option value='John'>Name</option>
<option value='City'>address</option>
<option value='7854245'>Phone</option>
</select>

<SCRIPT LANGUAGE="JavaScript">
function getLayoutID(id_number)
{
$x = id_number
<?

?>
}
</script>
[/HTML]i really dont know how to pass id_number to $x. i want to query id_number in mysql.
Sep 3 '07 #1
2 1566
acoder
16,027 Expert Mod 8TB
Please use CODE tags when posting code. Thanks!

You will need Ajax for this. See the Offsite Links thread for some links to Ajax tutorials. Also check out this Ajax example.
Sep 3 '07 #2
pbmods
5,821 Expert 4TB
Removed superfluous '?' from title that could actually result in FEWER responses.
Sep 3 '07 #3

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

Similar topics

6
by: Don | last post by:
How do I pass PHP variables to JavaScript in the returned browser page? Thanks, Don
10
by: Sean Dockery | last post by:
I have the following HTML file that I've been using for testing... <html> <head> <script type="text/javascript"> <!-- function handleWindowLoad() { var items = ; for (var i = 0; i < 11; i++)...
2
by: Thomas | last post by:
Sorry if this is a really obvious question but I am new at this. I would like to have my javascript pass some variables it gets to a php page I have to log the inputs. The inputs are collected in...
2
by: André | last post by:
Hi, I have to pass a lot of variables from vb.net to javascript using client callback. the problem is that there are single variables, but also arrays with differents indexes. I have two...
3
by: drec | last post by:
I am creating a search box that the user types a value in, and then this gets passed to another page called search.php I would like to be able to pass these values through the URL, but I cant...
3
by: Steve Kershaw | last post by:
Hi, I need to pass a value from a hidden input: <input id="hiddentxtWidth" type="hidden" value="1065" /> to a JavaScript function. I've tried the following: <script type="text/javascript" >...
1
by: adpinc | last post by:
Hello all! I am a seasoned programmer, but not really with Javascript. I have a strange phenomenon going on that for the life of me I cannot figure out what is wrong. I am calling a javascript...
8
by: BigZero | last post by:
Hello, i need to pass some variables or value to javascript from php script. well all i need to pass to value to javascript that is with in same php file the two values r in php i need to pass...
1
by: kkshansid | last post by:
i want to pass both variables($q1 and value of select) from this php page to java script so that i can get both variables in second php file srt.php <script type="text/javascript"...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.