Jump to content

Table To update from database

Go to solution Solved by Ch0cu3r,

Recommended Posts

Hi Peeps


So basically im creating a "customer page"


i have 2 tabs, 1 is customer info which is the primary and the invoicing tab


I have a date picker in the invoicing tab which im hoping will populate a table below.


I tried having the form post to php but this resets the page which then goes to the customer info tab so im guessing this will have to be done with

jquery and ajax.


could someone please point me in the right direction to do this?


here is the current page for better explanation:




All help is greatly appreciated in advance :)




Link to comment
Share on other sites

javascript/ajax/jquery is not required to make the client/server functionality for a web page. they are used to add to the presentation of the web page.


you should get your client-side and server-side code to work first (even to the point of it working with javascript disabled), because you will need all the same html markup and php code, with or without using javascirpt/ajax/jquery.


your two tabs are just two 'views' that are present on the web page. when you pick/enter a date in your form field and submit the form, which should be a get method form since you are determining what the page will display, it should submit any existing get parameters as hidden form fields, along with the date. the server side code should then use the submitted get parameters and retrieve any data for the two views, produce the two sections of output for the page, then produce the complete html document and send it to the browser.


once you get all the program logic in place and working, then add things like displaying the output in tabs, adding a date picker to populate the form field, using events to submit forms, using ajax to send data to the server and display the result, ...

Link to comment
Share on other sites

  • Solution



I tried having the form post to php but this resets the page which then goes to the customer info tab so im guessing this will have to be done with

jquery and ajax.

Doesn't have to be. 


If the the form is submitting to itself then in the forms action add a hash, eg

<form action="#invoice" method="post">
... form ields ...

When the page loads, in javascript use  window.location.hash  to get the hash value, it it is equal to #invoice then have the invoice tab be the active tab rather than the customer tab. Judging by your screenshot you are possibly using Bootstrap tabs component? Looking at the documentation you should be able to call the .show() method on your invoice tab to set as active, eg

if(window.location.hash == '#ivoice') {
    $('#invoiceTabIdHere').tab('show'); // should make the invoice tab active
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.