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 8860113
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T15:12:22+00:00 2026-06-14T15:12:22+00:00

Possible Duplicate: How to have user submit text in form and AJAX it to

  • 0

Possible Duplicate:
How to have user submit text in form and AJAX it to enter to db and show up on same page?

What I want to do:

index.html -> form submit to some.php -> process data (from index.html) and send data to server.php -> returning results to a index.html div.

I’ve read ajax, jQuery, I have seen hundreds of questions on this site, but I couldn’t figure it out yet.

index.html:

<form action="some.php"  method="post">
    Start date: <br/> <input name="idate" id="firstdate" type="text" /><br />
    End date: <br /> <input name="fdate" id="seconddate" type="text" /><br />
    <br />
    <input type="button" id="searchForm" onclick="SubmitForm();" value="Send" />
</form>

some.php:

<?php
session_start();
$_SESSION['data1'] = $_POST['firstdate'];
$_SESSION['data2'] = $_POST['seconddate'];
?>

 function drawChart() {
    var jsonData = $.ajax({
        url: "server.php",
        dataType: "json",
        async: false
    }).responseText;

    var obj = jQuery.parseJSON(jsonData);
    var data = google.visualization.arrayToDataTable(obj);

(...)

server.php:

$SQLString = "SELECT    
            count(score) as counts,
            DATE(date),
            SUM(CASE WHEN gender = 1 then 1 ELSE 0 END) Male,
            SUM(CASE WHEN gender = 2 then 1 ELSE 0 END) Female,
            AVG(age) as age, score
            FROM persons  
            WHERE date > '".$_SESSION['date1']."' AND date < '".$_SESSION['date2']."' 
            GROUP BY DATE(date) 
            ORDER BY DATE(date) asc";   

(...) 
$data[0] = array('day','counts','Male','Female','Age','Score');     
(...)
echo json_encode($data);
  • 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-14T15:12:23+00:00Added an answer on June 14, 2026 at 3:12 pm

    HTML:

    <form id="my_form">
        Start date: <br/> <input name="idate" id="firstdate" type="text" /><br />
        End date: <br /> <input name="fdate" id="seconddate" type="text" /><br />
        <input id="submit_form" type="submit" value="Submit">
    </form>
    
    <div id="update_div"></div>
    

    jquery:

    var submit_button = $('#submit_form');
    
    submit_button.click(function() {
    
        var start_date = $('firstdate').val();
        var end_date = $('seconddate').val();
    
        var data = 'start_date=' + start_date + '&end_date=' + end_date;
    
        var update_div = $('#update_div');
    
        $.ajax({
            type: 'GET',
            url: 'proccess_form.php',
            data: data,   
            success:function(html){
               update_div.html(html);
            }
        });
    });
    

    proccess_form.php:

    <?php
        $date1 = GET_['start_date'];
        $date2 = GET_['end_date'];
    
        // PERFORM THE SQL QUERY //
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: how to prevent multiple form submit from client side? We have a
Possible Duplicate: Submit Login control button when I hit Enter I have a Login.aspx
Possible Duplicate: Validate email address in Javascript? I have an HTML form that uses
Possible Duplicate: Html select option lost data after submit I have a select menu
Possible Duplicate: JavaScript Function Definition in ASP User Control Hi, I have a generic
Possible Duplicate: Handling a Click for all controls on a Form I have a
Possible Duplicate: yyyymmddhhmmss to YYYY-MM-DD hh:mm:ss in perl? I have a datetime from user
Possible Duplicate: How to show the Are you sure you want to navigate away
so i have a page where a user can submit his own links i
Possible Duplicate: CountDownTimer- that the user increments. Issues I have to make an application

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.