Go Back   WarriorForum - Internet Marketing Forums > Warrior Support Forums > Programming Talk
Register Blogs FAQ Social Groups CalendarHelp Desk

Reply
 
LinkBack Thread Tools
Old 09-15-2009, 02:28 AM   #1
Active Warrior
 
Join Date: May 2009
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
Default Table location?

I have a php function to create a table with variable size. The routine works if it executes as the first thing in the program. However the idea is have a user click one of the buttons first before a table of right size is generated accordingly. But the table doesn't show with buttons on the top of the webpage. It seems the website doesn't know where to create the table. Is there any location I need to keep track for the table?
WarrenW is offline   Reply With Quote
Old 09-15-2009, 01:30 PM   #2
Senior Warrior Member
War Room Member
 
Steve Diamond's Avatar
 
Join Date: Apr 2006
Location: Tucson, AZ, USA.
Posts: 1,025
Thanks: 120
Thanked 158 Times in 115 Posts
Social Networking View Member's FaceBook Profile  View Member's Twitter Profile  View Member's YouTube Profile
Contact Info
Send a message via Skype™ to Steve Diamond
Default Re: Table location?

Hi, Warren. To create a table after the page has loaded, you have to use client-side scripting (JavaScript).

There's no way to directly execute a server-side function (PHP) by clicking a button on the page. That's what you've discovered.

But there is a way to indirectly execute a server-side function and insert the results into the current page. You have to use Ajax technology, which combines client-side scripting and server-side scripting.

In this case it would mean that when the button is clicked, some JavaScript code runs on the client side that calls the PHP function on the server in the background. When the PHP function finishes running, it calls another JavaScript function in the webpage, which then adds the result of the PHP function into the page in the appropriate place.

I know this isn't a full solution, but at least it lets you know why your attempt isn't working and what direction you need to follow. I hope it helps.

Steve

Executive I.T. consulting for small/medium business
Website development | PHP - MySQL - JavaScript expert programming
Software requirements analysis | Specification writing
Project management | Vendor relationship management
Steve Diamond is offline   Reply With Quote
Old 09-15-2009, 02:38 PM   #3
Active Warrior
 
Join Date: May 2009
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
Default Re: Table location?

Steve,

You just make my day! What you talk about is the part of HTML I never really quite understood. As a long time realtime programmer, I keep forgetting HTML's limitation. Now I have a good reason to pick up javascript. Once again, thanks a lot!


Warren
WarrenW is offline   Reply With Quote
Old 09-15-2009, 03:12 PM   #4
Senior Warrior Member
War Room Member
 
Steve Diamond's Avatar
 
Join Date: Apr 2006
Location: Tucson, AZ, USA.
Posts: 1,025
Thanks: 120
Thanked 158 Times in 115 Posts
Social Networking View Member's FaceBook Profile  View Member's Twitter Profile  View Member's YouTube Profile
Contact Info
Send a message via Skype™ to Steve Diamond
Default Re: Table location?

Hi, Warren. You're welcome! I'm glad you found my reply helpful. It's often difficult to know what technological level to aim at, and it seems as if I guessed reasonably well.

You'll be interested to know that there are a number of mature JavaScript frameworks and libraries that will help a great deal with this kind of programming. Three of the best are:Steve

Executive I.T. consulting for small/medium business
Website development | PHP - MySQL - JavaScript expert programming
Software requirements analysis | Specification writing
Project management | Vendor relationship management
Steve Diamond is offline   Reply With Quote
Reply

  WarriorForum - Internet Marketing Forums > Warrior Support Forums > Programming Talk

Tags
location, table

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



All times are GMT -6. The time now is 09:34 AM.