473,396 Members | 1,766 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,396 software developers and data experts.

passing a variable

Hi,

How to get the value passed using javascript in the next page. The code I have used is this.

cal.php

Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <head>
  3.  
  4. </head>
  5. <script type="text/javascript">
  6. function Show(){     
  7.  
  8.  
  9.     var date_id = document.getElementById("date_id").value;
  10.  
  11.  //alert(date_id);
  12. self.location='display.php?'+date_id; 
  13. }
  14. <body>
  15. <script type="text/javascript" src="date-picker.js"></script>
  16. <form name="Calender1" action="display.php" method="POST">
  17. <a STYLE="text-decoration: none" onmouseover="window.status='Date Picker';return true;" onmouseout="window.status='';return true;" href="javascript:show_calendar('Calender1.date_id')" >
  18.  
  19. <IMG title="calendar" height=21 src="iconCalendar.gif" width=30 border=0></a>&nbsp;&nbsp;
  20. <input type="textbox" class="textBox" type="text" readonly name="date_id" id="date_id" size="10">
  21. </form>
  22. <input type="submit" value="UPDATE" onclick="Show()">    
  23. </body>
  24. </html>
And I am trying to receive the value of date_id variable in the display.php page like this

display.php

Expand|Select|Wrap|Line Numbers
  1. <?php
  2.  
  3.     $id = $_GET['date_id'];
  4.     print $id;
  5. ?>
But I am not able to get the date variable in the display.php page. Does anybody have an idea as how to do this.

With regards
Mar 4 '08 #1
3 1357
hsriat
1,654 Expert 1GB
You are just passing the variable value, but not variable name.
Expand|Select|Wrap|Line Numbers
  1. self.location='display.php?date_id'+date_id;
Do this change in line 12.
Mar 4 '08 #2
Hi,

Thanks for the solution.
It is working
Mar 6 '08 #3
hsriat
1,654 Expert 1GB
Expand|Select|Wrap|Line Numbers
  1. self.location='display.php?date_id='+date_id;
I missed the '=' though.
Mar 6 '08 #4

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

Similar topics

3
by: domeceo | last post by:
can anyone tell me why I cannot pass values in a setTimeout function whenever I use this function it says "menu is undefined" after th alert. function imgOff(menu, num) { if (document.images) {...
58
by: jr | last post by:
Sorry for this very dumb question, but I've clearly got a long way to go! Can someone please help me pass an array into a function. Here's a starting point. void TheMainFunc() { // Body of...
39
by: Mike MacSween | last post by:
Just spent a happy 10 mins trying to understand a function I wrote sometime ago. Then remembered that arguments are passed by reference, by default. Does the fact that this slowed me down...
6
by: Scott Zabolotzky | last post by:
I'm trying to pass a custom object back and forth between forms. This custom object is pulled into the app using an external reference to an assembly DLL that was given to me by a co-worker. A...
11
by: John Pass | last post by:
Hi, In the attached example, I do understand that the references are not changed if an array is passed by Val. What I do not understand is the result of line 99 (If one can find this by line...
6
by: MSDNAndi | last post by:
Hi, I get the following warning: "Possibly incorrect assignment to local 'oLockObject' which is the argument to a using or lock statement. The Dispose call or unlocking will happen on the...
12
by: Andrew Bullock | last post by:
Hi, I have two classes, A and B, B takes an A as an argument in its constructor: A a1 = new A(); B b = new B(a1);
3
by: James Robertson | last post by:
I am new to the ASP and VB thing so be kind. Question I have is that I have created an ASPX web site to use as an E-Mail page. But I want to use this for a lot of users. Can I create the link on...
3
by: DaTurk | last post by:
If I call this method, and pass it a byte by ref, and initialize another byte array, set the original equal to it, and then null the reference, why is the original byte array not null as well? I...
11
by: =?Utf-8?B?U3VqZWV0?= | last post by:
If there are long strings (like 1MB or 2MB) is it more performant to pass those by ref to methods or by value?
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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,...

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.