Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8004875
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T17:03:22+00:00 2026-06-04T17:03:22+00:00

I am using Jquery and it is working perfectly until i submit a form

  • 0

I am using Jquery and it is working perfectly until i submit a form using Get Method.

I am trying to get information between 2 dates. Here is my code:

date.php:

......

$date1 = $_GET['date1'];
$date2 = $_GET['date2'];
echo"<Form method='get' action=''>
<label>From: </label> <input class='date' id = 'date1' type='date' name='date1' size='9' value = '$date1'></input>
<label>To: </label> <input class='date' id = 'date2' type='date' name='date2' size='9' value = '$date2'></input> <br/> ";

echo "<input type='submit' class = 'center' value='submit' name='submit'>";
echo'</Form>';

if($date1 != '' && $date2 != '' ){
report($date1,$date2);
}
......

<script type='text/javascript' src='js/jquery.js'></script>
<script type='text/javascript' src='js/jquery-ui.js'></script>
<script type='text/javascript' src='js/ui.js'></script> //my jquery functions

......

ui.js:

$('.date').datepicker({dateFormat: 'yy-mm-dd'});

function toggleReport(table){   
$('#'+table).toggle('slow').colSpan = 3;
}

Is there anything wrong with my GET method in my form?
should i use ajax instead? if i should, how do i use Get in ajax? until now i only used ajax with post method

THANKS!!!

EDIT:
it seems that it this whole thing wasn’t my problem, something in my php is the problem.

I really got confused, i updated the date.php file above

Here is the report function:

function report($date1,$date2){

 $id = $_SESSION['id'];
 $techs = mysql_query("SELECT * FROM TECHS WHERE COMP_ID = '$id'")
 or die(); 
 $comps = mysql_query("SELECT * FROM COMPS WHERE COMP_ID = '$id'")
 or die(); 


  echo '<h1>Technicians</h1>';
  //tech Table
  echo "<table id='center'><tr><th id='hello'>Tech</th><th id='hello'>jobs</th><th    id='hello'></th></tr>";

 while($info = mysql_fetch_array( $techs ))  
{
$name = $info['Name'];
$jobs = mysql_query("SELECT * FROM JOBS WHERE COMP_ID = '$id' AND Technician = '$name' AND Date >= '$date1' AND Date <= '$date2' ORDER BY Date ASC") or die(); 
    $data = mysql_fetch_array( $jobs );

$number = mysql_num_rows($jobs);
if($number>'0'){
$name_st = remove_spaces($name);
$name_st.= '_t';
echo "<tr><td>$name</td><td>$number</td><td><img onclick='toggleReport(\"$name_st\");' src='images/report.png' border='0' alt='View report' title='View report'>
    </td></tr>";

    echo"
    <tr><td colspan='3' style='width:99%;' id='$name_st'  >
    <table >
        <th id='hello'>invoice</th><th id='hello'>Job ID</th><th id='hello'>Company</th><th id='hello'>Date</th><th id='hello'>Address</th><th id='hello'>Tech %</th><th id='hello'>Total</th><th id='hello'>Parts</th><th id='hello'>Company Parts</th><th id='hello'>Cash</th><th id='hello'>CC</th><th id='hello'>Check</th><th id='hello'>Fees</th><th id='hello'>Addt. Fees</th><th id='hello'>Company Balance</th><th id='hello'>Tech Balance</th><th id='hello'>Profit</th>

        ";
         $job = mysql_query("SELECT * FROM JOBS WHERE COMP_ID = '$id' AND Technician = '$name' ORDER BY Date ASC") or die(); 

        while($j = mysql_fetch_array( $job )){
            echo "<tr><td>".$j['invoice'].'</td>'.'<td>'.$j['jobID'].'</td>'.'<td>'.$j['Company'].'</td>'.'<td>'.$j['Date'].'</td>'.'<td>'.$j['Address'].'</td>'.'<td>'.$j['Tech_per'].'%</td>'.'<td>'.$j['Total'].'</td>'.'<td>'.$j['parts'].'</td>'.'<td>'.$j['comp_parts'].'</td>'.'<td>'.$j['cash'].'</td>'.'<td>'.$j['cc'].'</td>'.'<td>'.$j['check'].'</td>'.'<td>'.$j['fees'].'</td>'.'<td>'.$j['addt. fees <br> need to fix'].'</td>'.'<td>'.$j['comp_total'].'</td>'.'<td>'.$j['tech_total'].'</td>'.'<td>'.$j['profit'].'</td></tr>';
        }


        echo"
    </table></td></tr>";

}
  }
 echo '</table>';
 echo '<h1>Companies</h1>';
  echo "<table id='center'><tr><th id='hello'>Companies</th><th id='hello'>jobs</th><th   id='hello'></th></tr>";

   while($info = mysql_fetch_array( $comps ))  
 {
 $name = $info['name'];
 $jobs = mysql_query("SELECT * FROM JOBS WHERE COMP_ID = '$id' AND Company = '$name' Date >= '$date1' AND Date <= '$date2'  ORDER BY Date ASC") or die(); 
    $data = mysql_fetch_array( $jobs );

$number = mysql_num_rows($jobs);
if($number>'0'){
$name_st = remove_spaces($name);
$name_st.= '_d';
echo "<tr><td>$name</td><td>$number</td><td><img onclick='toggleReport(\"$name_st\");' src='images/report.png' border='0' alt='View report' title='View report'>
</td></tr>";

    echo"
    <tr><td id='$name_st' class = 'hidden' colspan='3'>
    <table >
        <th id='hello'>invoice</th><th id='hello'>Job ID</th><th id='hello'>Company</th><th id='hello'>Date</th><th id='hello'>Address</th><th id='hello'>Comp %</th><th id='hello'>Total</th><th id='hello'>Parts</th><th id='hello'>Company Parts</th><th id='hello'>Cash</th><th id='hello'>CC</th><th id='hello'>Check</th><th id='hello'>Fees</th><th id='hello'>Addt. Fees</th><th id='hello'>Company Balance</th><th id='hello'>Tech Balance</th><th id='hello'>Profit</th>

        ";
         $job = mysql_query("SELECT * FROM JOBS WHERE COMP_ID = '$id' AND Company = '$name' ORDER BY Date ASC") or die(); 

        while($j = mysql_fetch_array( $job )){
            echo "<tr><td>".$j['invoice'].'</td>'.'<td>'.$j['jobID'].'</td>'.'<td>'.$j['Company'].'</td>'.'<td>'.$j['Date'].'</td>'.'<td>'.$j['Address'].'</td>'.'<td>'.$j['Comp_per'].'%</td>'.'<td>'.$j['Total'].'</td>'.'<td>'.$j['parts'].'</td>'.'<td>'.$j['comp_parts'].'</td>'.'<td>'.$j['cash'].'</td>'.'<td>'.$j['cc'].'</td>'.'<td>'.$j['check'].'</td>'.'<td>'.$j['fees'].'</td>'.'<td>'.$j['addt. fees <br> need to fix'].'</td>'.'<td>'.$j['comp_total'].'</td>'.'<td>'.$j['tech_total'].'</td>'.'<td>'.$j['profit'].'</td></tr>';
        }


        echo"
    </table></td></tr>";

   }
 }
 echo '</table>';


}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T17:03:24+00:00Added an answer on June 4, 2026 at 5:03 pm

    Your form has a blank action attribute:

    <Form method='get' action=''>
    

    You need to put the URL you want to submit to in there, e.g., to submit back to the same ‘date.php’ page:

    <form method='get' action='date.php'>
    

    (I am assuming you are not trying to set it from JS because you said in a comment that “all” of your JS is a single statement that initialises your datepicker controls. If that is not the case please update your question to show all of the JS code related to the form.)

    EDIT: Sorry, I think I misunderstood the problem. I thought you meant that the form wasn’t working properly. If you’re saying that your JS isn’t working properly it is probably because it is running before the page has loaded. Within your ui.js file try wrapping your JS in a document ready handler:

    $(document).ready(function() {
        $('.date').datepicker({dateFormat: 'yy-mm-dd'});
    });
    

    Having said that, if you are submitting the page back to itself then Ajax would be a reasonable alternative.

    “how do i use Get in ajax?”

    Look at the $.get() and $.ajax() doco – apparently “GET” is actually the default for the type parameter.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working on select box and using jquery. HTML structure: <form method= action=
So I have ajax file upload partial (using Jquery Form plugin), it's working perfectly,
I am using following jQuery code to submit a form via AJAX. jQuery('form.AjaxForm').submit( function()
I am using this and it's working perfectly on the browser http://docs.jquery.com/UI/Sortable Now I
I am using BLOCKUI jquery confirmation dialog box plugin, Its working perfectly except its
I'm using a basic integration of jQuery Tools tabs function and it's working perfectly
I'm using the jquery form plugin to submit forms to my MVC application. The
I'm working on a form validation and submission using jQuery and AJAX. Now, most
I am using jQuery form validation plugin to verify the form.. It is working
i m using jQuery tablsorter plugin, it's working perfect,but now problem is ... i

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.