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

Dates do not POST right- I think

Hello Everyone,

I seem to be going no place fast...

Can't seem to get a single inline(embeded) jquery Datepicker dateText to post to the PHP and mysql correctly to return data from the table.. My reading has me to understand it should be right, but it is not. Now the datepicker select does have several events that trigger from the single select... data being requsted by the day, month, and year as well as sending the date to create a highcharts graph of data for hours of a day, days of a month, and months of a year.

The Table is very simple... date, time, power

Let me start to show how we get to the PHP...Here is the Javasctipt that makes the post. It should be sending the date selected...

Expand|Select|Wrap|Line Numbers
  1.  $(document).ready(function () {   
  2.       $('#datepicker').datepicker({dateFormat: 'yy-mm-dd', onSelect: function(dateText) {
  3.             var myDate = $(this).datepicker('getDate');
  4.             $('#apDiv1').html($.datepicker.formatDate('DD, d', myDate));
  5.             $('#apDiv5').html($.datepicker.formatDate('MM', myDate));
  6.             $('#apDiv7').html($.datepicker.formatDate('yy', myDate));
  7.  
  8.             $('#apDiv2').load('dayPower.php', {choice: dateText}, function() {
  9.                   $(this).show();
  10.             });
  11.             $('#apDiv4').load('dayGraph.php', {choice: dateText}, function() {
  12.                   $(this).show();
  13.             });
  14.             $('#apDiv6').load('monthPower.php', {choice: dateText}, function() {
  15.                   $(this).show();
  16.             });
  17.             $('#apDiv9').load('monthGraph.php', {choice: dateText}, function() {
  18.                   $(this).show();
  19.             });
  20.             $('#apDiv8').load('yearPower.php', {choice: dateText}, function() {
  21.                   $(this).show();
  22.             });
  23.             $('#apDiv10').load('yearGraph.php', {choice: dateText}, function() {
  24.                   $(this).show();
  25.             });
  26.       }});
  27. }); 
Now the PHP here, this should take the date and format it to the format that mysql needs to see, and then grab the data and echo it into the div I have made and directed..

Expand|Select|Wrap|Line Numbers
  1. <?  
  2. $choice = (isset($_GET['choice'])) ? date("Y-m-d",strtotime($_GET['choice'])) : date("Y-m-d"); 
  3. $con = mysql_connect("localhost","root","mackie1604");  
  4. if (!$con)  {  
  5. die('Could not connect: ' . mysql_error());  
  6. }  
  7. mysql_select_db("inverters", $con);  
  8.  
  9. $sql = 'SELECT sum(power) AS choice '         
  10. .'FROM feed '        
  11. .'WHERE date = $choice'; 
  12. $res = mysql_query($sql) or die('sql='.$sql."\n".mysql_error()); 
  13. $row = mysql_fetch_assoc($res); 
  14. echo $row['choice'], '<br />';  
  15. mysql_close($con); 
  16. ?> 
What could be wrong ?

If you do not understand what my meaning is, you can get a visual of what I am trying to do at http://www.pvmonitor.000a.biz/demo2.php
Dec 2 '10 #1
1 1823
JKing
1,206 Expert 1GB
If you are using post then you need to use the $_POST variable in your php not $_GET.
Dec 2 '10 #2

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

Similar topics

3
by: WJ | last post by:
1. How can I use POST method to post the following XML statements to an Html page or Asp page using Asp.net or 2. If the XML below is a file (text), how do I POST it to other web site...
4
by: Damien | last post by:
Hi guys, Before I spend hours barking up the wrong tree, am I right in thinking that there is no way for a non ASP.NET page to POST to a ASP.NET page and be able to retrieve the variables in any...
0
by: MARTIN LANNY | last post by:
Hi everyone, To bring you in the picture: I have the function to grab the html content from the page. Function requires only URL and Time Delay variables. Url, which I am submitting to this...
8
by: MARTIN LANNY | last post by:
Hi everyone, I am having a real trouble to figure out how to amend this code to switch from GET to POST method. -------------------------------------------------------- Public Function...
3
by: MaRCeLO PeReiRA | last post by:
Hi Guys, I am in troubles with some dates. "I need to know the difference, in days, between two dates." Well, if the difference is less than a month, so I could use:
1
by: Scott F K Hooper | last post by:
I have an aspx page that I want to use to collect info and create session variables before navigating to another aspx page to use the new session vars. Ie, consider the following page,...
2
by: paulquinlan100 | last post by:
Hi I've just started having some problems with my coded queries. They had been working fine but all of a sudden they seem to have started needing US style dates eg mm/dd/yyyy. When i build a...
3
by: computer_guy | last post by:
Hi Everyone, I run into a problem. I am trying to write an aspx that can dynamically generate an image based on some input parameters. Things are very simple if the size of the parameters is...
6
by: arnuld | last post by:
I don't understand, every week I post "Welcome Message" as a new post and it gets posted as reply to my older "Welcome Message", automatically. What exactly is happening ? I have tried both PAN...
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
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
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
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
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.